CAIRO -- Brazil and Ghana will play in the final of the Under-20 world cup.
Brazil beat Costa Rica 1-0 on Tuesday in the late semifinal after Ghana beat Hungary 3-2.
"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 a trophy."
Ghana will try to become the tournament's first African champion, against four-time winner Brazil in Friday's final. The Black Satellites lost to Brazil in 1993 and to Argentina in 2001.
Dominic Adiyiah scored two first-half goals for Ghana before Marko Futacs scored for Hungary in the 73rd minute. Abeiku Quansah put Ghana ahead 3-1 in 81st before Adam Balajti pulled Hungary within a goal 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."
Adiyiah is the tournament's leading scorer with eight goals, three behind Javier Saviola's record of 11 goals in 2001. Brazilian striker Adailton scored 10 in 1997.
Hungary 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.
"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, (Gulacsi) trod on me, I heard the ankle crack. I carried on playing, but it hurt so I preferred to come off."
In the other semifinal, Costa Rica nearly took the lead on Brazil in the first half, but goalkeeper Rafael made a spectacular, leaping save on David Guzman's shot.
After a strong first half of defending, Costa Rica broke down in the second. Alan Kardec was left unmarked at the back post and sent in a shot from a tight angle in the 67th.
"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 at this consistently high level," Brazil coach Rogerio Lourenco said.
"So the members of the team are just celebrating their victory tonight."