Spain attended their own funeral dressed in black. They came not to mourn their passing but to commemorate their life but there will be no evading the melancholy, nor the recriminations, and this was no celebration. It felt like it would be a game to endure not to enjoy. Spain departed Brazil to whistles and boos from Brazilian supporters who have been against them throughout this tournament and there were tears too, but they departed with a win.

Goals from David Villa, Fernando Torres and Juan Mata defeated Australia, prevented Spain from finishing bottom of Group B, and momentarily recalled a time when they were world champions, not the first team out. But there is no going back.

Torres scored the goal that began Spain’s era when he scored the winner against Germany in the final of the 2008 European Championship, and now he scored the goal that closed the era too. There may have been professional satisfaction but there was no smile, no raised arm and few came to shake his hand. There was nothing to cheer. There had not been much more of a reaction when David Villa opened the scoring in the first half.

The Australians will be seeing more of Villa: he will play there next season, as he awaits a definitive move to New York and a team who do not even exist yet. Spain will not see him again. This was his last game and when he was withdrawn early in the second half, he did so slowly and sadly, eyes down. As he sat on the bench, he put his head in his hands and cried. Neither he nor his team-mates ever wanted or ever expected it to end like this.

At least Villa could depart in a way that more or less befitted his career: with a goal. There was no place for the captain Iker Casillas nor for Xavi, this generation’s ideologue. His international career ended on the bench. A footballing “romantic”, as he himself has put it, he departed the World Cup without having played at Maracanã. At the end here, he headed straight down the tunnel. He did not even approach the pitch for one last, lingering look.

Deep down, Villa and Torres both know that they partly played because there was nothing to play for. Vicente del Bosque had said that he wanted to ensure that every player in the squad would get the chance to take part in the World Cup. Of those who had not played a minute at the tournament, only Juan Mata was left out of the starting XI. So there they were, up front together, just like old times. Villa, the miner’s son from Asturias, was especially active. He was also curiously addicted to flicks and back heels. And that was how the goal came too.

Andrés Iniesta’s wonderful pass released Juanfran on the right and he pulled the ball across the area where Villa applied the finish for the last time. Top scorer at Euro 2008 and at the World Cup four years ago, he became his team’s joint top scorer at this World Cup too, on one. With nine World Cup goals and sixty in total, achieved without the fanfare and political pressure afforded to other players, he became the country’s best ever striker.

Midway through the second half, Torres scored the 38th goal of his international career and probably the saddest too, slotting in neatly after another wonderful pass from Iniesta. It will be Iniesta who leads a new Spanish generation and another pass from him found Cesc Fábregas to cross for Juan Mata, who controlled and tucked the ball away neatly between the legs of Mathew Ryan. At least there was a smile this time; Mata came on as a substitute for his first minutes of this competition but he will surely have more in the future.

For now, though, it is the end. Spain had scored three times and largely controlled this game, even if this lacked the intensity, edge and importance of previous occasions. How could it not? Remember me like this, they appeared to be saying. Better still, remember me like that.

When the final whistle went, so did they. A bus took them straight to the airport where a plane waited to take them home.