Marrakech - Raja Casablanca scored twice in the last 10 minutes to stun Brazil's Atletico Mineiro 3-1 in their Club World Cup semi-final on Wednesday and earn a place in the final against Bayern Munich.
Mohaine Moutaouali fired home a controversial penalty in the 83rd minute and Vivien Mabide wrapped it up in stoppage time with a breakaway goal amid chaotic scenes.
Mouhssine Iajour had given Raja, who qualified as champions of host nation Morocco, the lead early in the second half before Ronaldinho curled a free kick in off the post to level for the South American champions.
It will be only the second time since the tournament has been played in its current format in 2005 that the final has not been between a South American and European team.
There were incredible scenes at the end as the Raja players surrounded Ronaldinho to ask for his shirt and took off his boots.
Mineiro, who had spent six months dreaming of the tournament since they won the Libertadores Cup, slunk disconsolately away, leaving their army of 10,000 fans with a long, painful journey back to Belo Horizonte.
Raja look more confident against a nervous, disjointed Atletico team and twice came close to taking the lead before halftime.
It was no surprise when they went ahead eight minutes into the second half when Iajour was sent clear on the right and fired a low shot past Victor.
Atletico appeared to be losing their way but grabbed an equaliser out of the blue when Ronaldinho curled in his free kick just after the hour.
The goal failed to inspire the Brazilians and Raja regained the lead in the 83rd minute when Rever was adjudged to have tripped Iajour, although replays suggested no contact was made.
Mabide produced the coup de grace in the fourth minute of stoppage time, scoring after the Atletico defence was left wide open.