Burkina Faso reached their first Africa Cup of Nations final by beating Ghana on penalties in a dramatic and controversial semi-final in Nelspruit.
The Burkinabe were denied spot-kicks in normal time and in extra-time, when they also had a goal ruled out, and saw Jonathan Pitroipa harshly sent off.
Mubarak Wakaso put Ghana ahead in normal time with a debatable spot-kick, before Aristide Bance equalised.
Burkina Faso won the penalty shoot-out 3-2 to set up a meeting with Nigeria.
That Pitroipa - outstanding throughout the tournament - will not be a part of that showpiece match in Johannesburg will take some of the joy out of the victors' celebrations.
Referee Slim Jedidi showed the winger a second yellow card for diving in extra-time when it looked liked a clear foul on the player, having earlier twice turned down plausible penalty claims from the Burkinabe.
Justice appeared to have been done when Emmanuel Agyemang Badu missed Ghana's fifth spot-kick in the shoot-out and Burkina Faso players began celebrating their historic achievement.
One step beyond
Burkina Faso's pervious best performance was reaching the semi-finals in 1998 when they hosted the tournament
Having played on the dreadful Mbombela Stadium pitch in all four of their previous games, it was perhaps no surprise that the Burkinabe settled more quickly than Ghana.
They should have won a penalty for what looked a blatant push by John Boye on Pitroipa. But the referee was not impressed, and then ruled that Mady Panandetiguiri had fouled Christian Atsu as the pair rose to battle to get their head on a free-kick into the box and awarded Ghana a penalty, which Wakaso converted.
It was a turnaround in fortune for the Black Stars, who had lost defender John Pantsil to injury within the first 10 minutes.
Skipper Asamoah Gyan then had a chance to put Ghana firmly in control when he beat the offside trap to bear down on Daouda Diakite but the Burkinabe keeper closed down the angle well to make a save.
But Burkina Faso, who have been resilient throughout the tournament, responded well and Prejuce Nakoulma had a good chance to hit back when he latched on to a long ball over the top, but blazed over the bar.
The end of the half belonged to Ghana and they could have had another penalty in the opening period when Paul Koulibaly tangled with Badu.
And the Black Stars missed another good chance to double their lead in open play when substitute Solomon Asante - on for Pantsil - poked over after great work by Kwadwo Asamoah.
The Burkinabe looked in determined mood after the break and soon saw Bance's header brilliantly clawed out of the top corner by Dauda.
Five minutes later, Gyan had an excellent chance to give Ghana some breathing space but struck the foot of the right post from 10 yards out.
A Twitter campaign has already begun to get Cas to rescind Jonathan Pitroipa's red card
And the Black Stars skipper was soon made to pay for that miss when Bance, one of three changes to the Burkinabe starting line-up, put his side level, side-footing home after Badu had been robbed in midfield.
Gyan had a chance to atone for his miss when he rose to meet a right-wing cross but his header went narrowly wide. To add injury to his disappointment, Gyan was then kicked by Paul Koulibaly while on the floor, with the Burkinabe man lucky to be booked rather than sent off.
With neither side able to make the breakthrough, the game went into extra-time and there were chances galore for both teams.
Ghana substitute Harrison Afful brought a good save from Diakite before Burkina Faso's Bakary Kone headed over from close range and then Bance beat two men and cut inside but lashed his shot over the bar.
Soon after came perhaps the most controversial call of the game. Nakoulma beat Asamoah to a throughball and poked the ball past Fatau Dauda but the referee ruled the goal out for a foul that was difficult to detect.
In the second period of extra-time the Burkinabe came close again when Bance's fierce drives somehow cleared off the line by Afful.
As extra-time ran down, Pitroipa was dismissed when he should have won a penalty, but more penalties were to come as the game came down to a shoot-out.
Pan Pierre Koulibaly was the only Burkina Faso player to miss as they ran out winners, with Badu the unfortunate man to miss for Ghana, who now contest the third-place play-off with Mali.
Burkina Faso coach Paul Put:
"The refereeing decisions were scandalous.
"We've lost Jonathan Pitroipa now for the final. He's very important to us, but we are 23 players and it's up to the technical staff to devise tactics to beat Nigeria without him and [the injured] Alain Traore."
Burkina Faso captain Charles Kabore:
"The referee is human, all humans make mistakes, but he happened to make too many tonight.
"But we're not going to dwell on that. We've qualified."
Ghana captain Asamoah Gyan:
"We came here to win [but] the better side won on penalties.
"We're all really sad now. That's normal. We're down, but we have to psyche ourselves up now for the third place play-off with Mali."
Sorry, we were unable to load match stats, please try again.