Ghana beat Hungary 3-2 to set up an Under-20 World Cup final against Brazil, which won 1-0 against Costa Rica in Tuesday’s other semifinal.

Tournament top-scorer Dominic Adiyiah scored twice for Ghana’s Black Satellites, while Alan Kardec’s second-half goal breached Costa Rica’s rigid defence in a scrappy match in which Brazil did not show its customary flair.

Ghana will attempt to become the first African team to win the competition, while Brazil aims to win it for the fifth time on Friday in Cairo. Ghana lost its previous finals to Brazil in 1993 and to Argentina in 2001.

“Zooming to the finals is a big thing and we’ve done that beautifully,” Ghana coach Sellas Tetteh said. “We are 90 minutes away from lifting the trophy.”

Ghana’s slick attack compensated for its shaky defence once more, with Adiyiah taking his tournament goals tally to eight. Hungary rallied from 2-0 down and threatened in the second half but was badly missing its influential playmaker Vladimir Koman, who was suspended.

Ghana captain Andre Ayew limped off in the second half and had an ice pack tied to his right ankle after the match.

“We played well overall, even though the second half wasn’t like the first. But if we win the final then we’ll be happy,” Ayew said. “We’re not necessarily looking to play pretty football at this stage of the competition.”

Costa Rica defended resolutely in the first half and almost scored on a rare attack only for Brazil goalkeeper Rafael to make a spectacular leaping save to keep out David Guzman’s powerful shot.

Brazil increased the pressure after the break, and Kardec punished some slack marking when he was left unmarked at the back post and thumped in a shot from a tight angle past goalkeeper Esteban Alvarado in the 67th minute.

“More than anything else, I’m really happy to get to the final. I congratulate the team—it’s not easy to play six games consistently at a high level,” Brazil coach Rogerio Lourenco said.

“So the members of the team are just celebrating their victory tonight.”

Costa Rica coach Ronald Gonzalez was also proud of his side’s effort.

“When you play against Brazil, you can’t just play (freely) and take every chance. You have to be mindful of who you are playing,” Gonzalez said. “This was a good performance after two tough games.”

Military conscripts in brightly colored tracksuits once again filled Cairo’s International Stadium in their thousands, heavily outnumbering the small pockets of travelling fans from Ghana, Hungary, Brazil and Costa Rica.

Locals waved Egyptian flags and some chanted for Brazil—since Costa Rica had knocked out Egypt in the last 16.

They watched Adiyiah’s brace put Ghana 2-0 up by halftime, before substitute Marko Futacs brought Hungary back into the match in the 73rd minute.

Abeiku Quansah restored Ghana’s two-goal lead in the 81st, but Adam Balajti scored in the 84th.

“The first half we were really, really poor and I don’t know what the reason was,” Hungary goalkeeper Peter Gulacsi said. “When you concede three goals, of course you’re disappointed, but I think we had our chances to equalize.”

Gulacsi said Koman’s absence was keenly felt.

“We missed him as a player and as a leader on the pitch,” Gulacsi said.

Ghana’s first goal came in the 10th minute, when Ayew intercepted a poor back pass and skipped round Gulacsi to provide Adiyiah with a tap-in. Adiyiah added another in the 31st when he headed in Samuel Inkoom’s cross from the right.

Ayew says he twisted his ankle making the goal, and is unsure whether he will recover in time to face Brazil.

“I don’t know. We’ll see. It’s tough, it hurts because I would like to be at 100 percent,” Ayew said. “On the first goal, he (Gulacsi) trod on me, I heard the ankle crack. I carried on playing, but it hurt so I preferred to come off.”

Adiyiah is three behind Javier Saviola’s record of 11 goals in 2001. Brazil striker Adailton scored 10 in 1997.

Hungary’s nervous start suited Adiyiah perfectly.

“This was the first time in the tournament that we really had some pressure—a chance to make the final,” Hungary assistant coach Imre Kenyeres said. “It was only in the second half that we showed what we can do.”

More In: Football | Sport