Matt Miazga scored on a closer-range header from Graham Zusi’s corner kick in the 88th minute, giving the United States first place in its Concacaf Gold Cup group with a 3-0 victory over Nicaragua on Saturday night.

Panama’s 3-0 win over Martinique in the first match of the doubleheader meant the US needed a three-goal win to move back over Los Canaleros into first. But the Americans struggled for long stretches against Nicaragua, a team ranked 105th by Fifa.

Joe Corona scored his first international goal in four years in the 37th minute and Kelyn Rowe doubled the lead in the 56th with his first international goal, but the US squandered opportunities when Dom Dwyer and Corona took poor penalty kicks in the second half that easily were saved by Justo Lorente.

Nicargua’s Luis Copete was ejected in the 86th minute for his second yellow card and Luis Galeano was receiving treatment for an injury, giving the US had a two-man advantage when Zusi took his free kick from about 30 yards. Miazga, a Chelsea defender playing his first international match since May 2016, had an open header near a post and scored his first goal in three national team appearances.

The US and Panama both finished with seven points and a plus-four goal difference, but the Americans won the group bases on total goals, 7-6. The Americans have won their group in 13 of 14 Gold Cups, finishing second to Panama in 2011.

Next up for the US is a quarter-final Wednesday in Philadelphia against a third-place team from another group, likely Honduras, El Salvador or Jamaica. A second-place finish would have meant a US-Costa Rica matchup.

US coach Bruce Arena used a mostly junior varsity roster for the first round but plans to add reinforcements from the varsity for the knockout phase. Goalkeeper Tim Howard and midfielder Michael Bradley watched the match from the stands.

For the first-ever matchup between the US and Nicaragua, Arena changed his entire starting lineup from Wednesday’s 3-2 win over Martinique, giving goalkeeper Bill Hamid his first appearance since an exhibition at Ireland in November 2014. Arena has used 22 of his 23 players in the tournament, all but goalkeeper Sean Johnson.

Alejandro Bedoya set up the first two US goals. Bedoya crossed to Corona, who took three touches to create space for a shot that deflected in off Bismarck Veliz for Corona’s third international goal, his first since scoring against Cuba and El Salvador in the 2013 Gold Cup.

Dwyer, attempting to join Alexander Rae and Eddie Johnson as the only players to score in their first three US matches, hit a waist-high penalty that Lorente dived right to save after Dwyer was brought down by Marlon Lopez.

Rowe, making his third appearance, scored after Bedoya intercepted a ball. Bedoya exchanged passes with Dwyer, then fed Rowe, who scored with the outside of his boot from inside the penalty area.

Corona took the second penalty after a handball was called on Daniel Cadena but took a weak kick down the middle.