Diego Costa, Koke

Diego Costa, left, celebrates with teammate Koke after scoring for Atletico Madreis in a Champions League game against Chelsea. Costa could provide a spark for the Spain in the World Cup this summer. (Glyn Kirk / AFP / Getty Images / April 30, 2014)

With a win in this summer's World Cup, Spain would cement its legacy as the best soccer team in a generation — if not one of the best ever.

Germany, on the other hand, goes to Brazil riding an 18-year title drought in major competitions, needing a trophy to rescue what has been an otherwise lost generation.

Spain, a team whose core has played together for nearly a decade, is ranked No. 1 in the world. Germany, a team that had much of its core in high school a decade ago, is ranked No. 2 in the world.

And if Pele is half as good at predicting soccer matches as he was at playing in them, there's a good chance Spain and Germany will settle their differences in the World Cup final July 13 in Rio de Janeiro.

"I saw several national teams this year," said the legendary, Brazilian, widely considered the best player of all time. "But the two who I think will be very strong — to talk now, before the games? Germany has a very good team, a young team. And then Spain, Spain is a team who plays together."

Spain is also a team that has a chance to do something no country has done since Pele's Brazil 52 years ago: win consecutive World Cups. It has already won the last two European Championships, something that had never been done before.

Coach Vicente del Bosque has engineered Spain's unprecedented run of success with a precision passing game known as tika-taka, which traces its roots to Johan Cruyff's tenure as club coach at Barcelona. It relies on technically skilled players with excellent touch and vision, and Spain certainly has that with midfielders Xavi Hernandez, Andres Iniesta, Cesc Fabregas and Sergio Busquets, who have developed impressive chemistry during their time as teammates at Barcelona.

And now Spain may have an additional weapon in electric forward Diego Costa, who was called up by his native Brazil for a pair of friendlies last year before announcing in October than he preferred to represent Spain.

He should not expect a warm welcome when he returns home next month.

"A Brazilian player who refuses to wear the shirt of the Brazilian national team and compete in a World Cup in your country is automatically withdrawn," an angry Brazilian Coach Luiz Felipe Scolari said. "He is turning his back on a dream of millions, to represent our national team, the five-time champions, in a World Cup in Brazil."

But Costa, who is currently battling a hamstring strain, might not be the only one who could have trouble playing in Brazil. When Spain won four years ago in South Africa — on an Iniesta goal 26 minutes into overtime against the Netherlands — it became the first European team to win a World Cup outside the continent. The seven tournaments played in the Americas have all been won by South American teams, Brazil three times and Uruguay and Argentina twice each.

"It's very, very difficult to win a World Cup for a European team in South America," says U.S. Coach Juergen Klinsmann, who played in three World Cups for Germany and coached in one. "So when people ask me who's your favorite team, I said I think it's Brazil. But then it's going to be down to Spain and Germany to challenge them. Just from a quality point of view."

And Klinsmann is certainly aware of the quality of the German team, having helped rebuild the program a decade ago while grooming Joachim Loew to take his place as coach.

Germany too relies on its midfield and it has one of the best — and perhaps the deepest — in the world with Mesut Ozil, Thomas Mueller, Marco Reus, Toni Kroos, Bastian Schweinsteiger and Mario Goetze, among others.

But whereas Spain uses its small, skilled midfielders to retain possession, Germany uses its big, physical midfielders to attack. And over the last few years the two competing systems have battled for superiority.

When Bundesliga clubs Bayern Munich and Borussia Dortmund reached the final of the Champions League last summer — the third time since 2000 two teams from the same country squared off for the title — the German game was considered ascendant.

But now Spain is back in vogue after La Liga rivals Real Madrid and Atletico Madrid advanced to this year's final. The Champions League is not the World Cup, however, so it may take a World Cup trophy this summer for either country to stake a true claim for supremacy.

Yet there might be even more at stake for Germany, whose national team hasn't won a major title since Klinsmann captained it to a Euro crown in 1996, when the vast majority of today's national team players were in grade school.

"Sooner or later, every generation has to put kind of that stamp on their career," Klinsmann said. "In Germany at least, through our history, every big generation won a trophy. It was the '54 generation that kind of made the country become alive again after World War II. It was the '74 generation, with these exceptional players like [Franz] Beckenbauer. And then it was the '90s and we were kind of the generation of the new picture of Germany. Unification and the wall comes down and now we go into Italy and we win this thing.

"So every kind of special generation had a title on their chest. This is now what this generation is about. They have to understand that compliments here and there, it's nice getting compliments. But it's also nice to win a trophy at the end of the day because that will change your life forever."

kevin.baxter@latimes.com