Neymar is expected to earn his 40th cap for Brazil on Wednesday against Switzerland in friendly play. Reuters

There was plenty of drama along the way, but the Confederations Cup has got the final that most neutrals craved: the hosts, looking to prove that they can claim the big prize back on home soil next year, against the most dominant side in the history of international soccer. In the fabled surroundings of the Maracana, Brazil will meet Spain on Sunday at 6 p.m. ET.

Arriving at the World Cup test event with little skepticism hanging over their heads, Brazil exceeded expectations by cruising through a potentially tricky group. Led by occasional moments of brilliance by Neymar, the Selecao made strong starts against Japan, Mexico and Italy. Comfortable victories were secured over their first two opponents, while a weakened Italy put up stiff resistance for a time in the second half before a third goal in as many games from the new face of the team, Neymar, helped his side to a 4-2 win.

It was a very different story in their semifinal agaisnt Uruguay, however. For the first time in the competition, Luiz Felipe Scolari’s men appeared inhibited, perhaps by the pressure from their demanding support or just the occasion itself. Had Diego Forlan converted an early penalty the script may have been shredded. The nation that inflicted Brazil’s most devastating soccer moment at the Maracana in the 1950 World Cup gave the hosts all they could handle before Neymar and Paulinho, arguably their two best players of the competition, combined for a late winner.

Yet, that drama was nothing compared to what was to unfold the following day. Like their opponents in the final, Spain had little trouble in their group as they recorded three straight wins. The first half of their opening game against Uruguay still marks the best showing by any side thus far in the Confederations Cup. There followed a second-string blitzing of minnows Tahiti, before Nigeria offered up some resistance only to eventually be brushed aside.

But the World and European champions were then pushed all the way by Italy in their semifinal. Refusing to sit back in reverence to the spell-binding tiki-taka of their opponents, the Azzurri were proactive and could have been at least a couple of goals to the good at the break. Spain’s success over the past seven years, though, has built an incredible winning mentality that seemed unimaginable not so long ago when they had a not-undeserved reputation as serial chokers.

La Roja again refused to be beaten. They came on strong in extra time and then held their nerve, scoring all seven penalties, as they made it three wins out of three in shootouts in their incredible reign atop the international scene.

Vicente Del Bosque’s side will have to show plenty of resilience once again in the final. Not only will they be facing a packed partisan crowd in the biggest match to date in the newly renovated Maracana, but they will have had less than 72 hours, and a day less rest than their opponents, to recover from having battled it out for 120 minutes and more in the stifling heat and humidity in Fortaleza.

For a competition often derided in the past as an unwelcome distraction from a summer of rest and recuperation, there will be much on the line. A Spanish win would not only see them take home the one trophy so far to elude them but also lay down a marker that they are still very much the side to beat as they try for an unthinkable fourth straight major tournament win at the 2014 World Cup. While for Brazil, victory would fill the inexperienced squad, as well as their supporters, with belief that the ghost of 1950 can finally be exorcised.

Follow Jason Le Miere on Twitter