Cleveland — Alejandro Bedoya can watch the rest of the CONCACAF Gold Cup after helping the U.S. avoid an embarrassing second-place finish in its group.

Bedoya set up goals by Joe Corona and Kelyn Rowe, and Matt Miazga’s close-range header in the 88th minute from Graham Zusi’s free kick gave the United States a 3-0 win over Nicaragua on Saturday night, just enough to leapfrog Panama for the Group B lead.

Bedoya is among six players on the 23-man roster who will be replaced for the knockout phase. His second child is due early next week.

“It’s tough, but this is something we have talked about,” Bedoya said. “As much as I would have loved to stay, we’re welcoming a new life.”

Goalkeeper Tim Howard and midfielder Michael Bradley watched from the stands and are among six players U.S. coach Bruce Arena plans to add for the knockout stage along with forwards Clint Dempsey and Jozy Altidore, midfielder Darlington Nagbe and goalkeeper Jesse Gonzalez — whose approval to switch affiliation from Mexico to the U.S. was granted in late June.

“Alejandro is a very good player,” Arena said. “In this three- or four-week period that we’ve been together he continues to demonstrate that. He can play a number of positions and he’s a really versatile player. He does an excellent job.”

Panama’s 3-0 win over Martinique in the first match of the doubleheader meant the U.S. 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. They squandered opportunities when Dom Dwyer and Corona took poor penalty kicks in the second half that easily were saved by Justo Lorente.

“Give the goalkeeper for Nicaragua some credit — two penalty kick saves in a game isn’t bad — but we didn’t do well with our kicks,” Arena said. “It was a game where we wasted some opportunities and made it pretty difficult on ourselves. However, at the end I’m pretty proud of our team that they kept battling and they knew that they needed to get three goals in the game and they managed to do it in the end.”

Nicaragua’s Luis Copete was ejected in the 85th minute for his second yellow card, and Luis Galeano was receiving treatment for an injury, giving the U.S. a two-man advantage when Zusi took his free kick from about 30 yards. Miazga, a 21-year-old 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.

“It was kind of too good to be true,” Miazga said. “I wasn’t really marked. The player who’d been marking me all game got a red card, so I was kind of free and Graham played a phenomenal ball. He floated it in, and I saw it all the way and guided it into the goal.”

Miazga spent last season on loan to Vitesse Arnhem in the Dutch Eredivisie and had not played in a match since May 14.

“The field was a little bit sticky, so we couldn’t really play fluid football, but it is what it is,” Miazga said. “We had to manage it.”

The U.S. 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 U.S. is a quarterfinal 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 U.S.-Costa Rica matchup.

The U.S. improved to 6-0-5 since Arena replaced Jurgen Klinsmann in November and returned for his second stint as coach. Arena tied Bob Bradley (10-0-1), who replaced him after the 2006 World Cup, for the longest unbeaten streak at the start of an American coaching tenure.

For the first-ever matchup between the U.S. 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.

Corona gave the U.S. the lead when he took three touches and sent a 16-yard shot that deflected in off Bismarck Veliz. It was his 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 U.S. matches, hit a waist-high penalty in the 51st that Lorente dived right to save after Dwyer was brought down by Marlon Lopez.

Rowe, making his third appearance, scored after Bedoya intercepted a Bryan Garcia pass. Bedoya passed to Dwyer, then had the ball tackled back to him. He fed Rowe, who scored with the outside of his boot from 7 yards.

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

Hamid made a sprawling save in the 74th to parry Juan Barrera’s 25-yard shot, then leaped on the rebound to deny Jorge Hurtado a shot.