At a café in Madrid, Jorge Valdano lets his thoughts travel back 33 years to a day in June 1985. And he has no doubts. “It was the most agonising game of my life,” the 62-year-old Valdano said, a man who has seen it all as a player, manager, sporting director, writer and commentator.

He is referring to the World Cup qualifier between Valdano’s Argentina and Peru. It was the last game of the group and there was a ticket to the World Cup in Mexico at stake. A draw was enough for Argentina, but surprisingly the Peruvians were leading 2-1. The loser would be facing a difficult additional round of qualifiers against three other South American teams. “We couldn’t find a way to the goal. We were in serious danger of missing out of the World Cup. But then Gareca came onto the pitch,” Valdano said, referring to the substitution after an hour in Buenos Aires.

Ricardo Gareca was a lanky forward, who jogged on to the muddy pitch with his socks rolled down to his ankles. His role with the Argentina national team had never been important, but on this day he would be the decisive player. With ten minutes remaining Daniel Passarella received the ball on the right, controlled it with his chest and struck the ball across goal. The ball pinged off the far post, bounced back and Gareca pushed it the last inches into the goal. Argentina had qualified for the World Cup. Peru would stay home. “We were whistled from the pitch,” Valdano said. “On that day, no-one could predict that one year later we would become world champions.”

The match in Buenos Aires, meanwhile, would come to symbolise the beginning of Peru’s tribulations, which would last for decades and develop into a national trauma. With gifted players such as Teófilo Cubillas, Héctor Chumpitaz and Juan Muñante, Peru had charmed the world in the 1970s with the World Cup quarter-final in 1970 and the Copa América title in 1975 as the highlights. But after the match in Buenos Aires in 1985 the team would slide down the rankings.

The national team became a disgrace to Peru and a generation grew up knowing nothing but a miserable national team. Until, that is, Ricardo Gareca became national coach at the beginning of 2015. The executioner from 1985 became the man who ended the misery and got Peru back to the World Cup after a play-off victory over New Zealand. “I was very moved that night,” said Piero Brescia, a young rock singer who has dedicated some of his music to the national team. “For so many years, our dream of the World Cup had been extinguished. The people have been frustrated for years. We have talked about football, we have played football, but we have never been there. Now we feel like part of the party for the first time. It was a terrific night. And Lima moved as if there was an earthquake." The celebrations of Jefferson Farfán’s 1-0 goal caused seismographs to react in such a way that warnings of earthquakes appeared on mobile phones in Lima. The country's president declared that the following day was a national holiday.

"The media threw mud at Gareca at first and wanted him to resign,” said Brescia. “But he showed what he was made of. I have tremendous respect for him. He has the back story that he kept us out of the World Cup at the time. It makes the players think that he must have some nous. He must know how to get to the World Cup. He is humble, simple and straightforward. The players feel comfortable with him.”

A whole nation passed the time counting down the days to the World Cup. The shirt sponsor Umbro expects to sell one million national team jerseys because of the World Cup. At the end of April, almost 40,000 match tickets had been sold in Peru. And several months before the tournament, Parque Kennedy in Lima’s Miraflores district was filled at night with children, young couples and whole families exchanging Panini World Cup stickers. "We are living a dream and experiencing a historic moment,” said the sociologist Aldo Panfichi, who has written about the role of football in the Peruvian society. “When Peru qualified, one saw extraordinary scenes in the streets. There was a flood of nationalism, which I have never seen before. Peru has always had a weak national feeling. Now there is a national pride that was not there before. Created by a team of humble players who have strong ties to the man on the street and who represent the changes in the country over the past few years.”

A few years ago, the Uruguayan Sergio Markarián, who unsuccessfully attempted to lead Peru through qualifying to the World Cup in Brazil, came to Panfichi to discuss the infamous lack of discipline within the Peruvian national team. The list of scandals over the years is long and includes, among other things, drinking sprees during gatherings of the national team and parties with prostitutes at the players' hotel. "Markarián,” Panfichi recalls, “was in despair: 'I've tried everything. I have taken all possible measures and done everything that a coach can do to create discipline. And nothing works.’ The problem was that it was a lost generation. It was a generation that grew up in an economic crisis in Latin America and with hyperinflation in Peru. They grew up in a country without any future perspective.

"This had the consequence that the national team was rarely a unit, but Gareca has now broken all that. He continues the tradition in this country of los caudillos, the great men who emerge in times of crisis. But at the same time he represents a change in the fact that hard work pays off and that he makes the best play instead of the biggest names. These changes fit very well with the mood on the street. Because the street has changed.

"Poverty has fallen and a new middle class has emerged. An ethic of progress and hard work has emerged. It has a strong connection to what has happened to the national team. It's a much humbler team that people on the street can identify with.

"And football is of course the national passion. That was the missing part. We did not see the confirmation on the football pitch that our country was in progress. We could not fully believe it, when the other countries were beating us by many goals."

A crucial turning point for Peruvian football took place in late 2014, when Manuel Burga, the controversial president of the football federation for 12 years, resigned after a long period of criticism. His fall brought new faces, one of them Juan Carlos Oblitas, a former player who became the new sporting director of the football federation.

"The situation was chaotic, to put it mildly,” the 67-year-old Oblitas said. “We were stuck in the past. It was clear to me that we had to change it all. We could not continue with the status quo. We had a lot of work in front of us, both in relation to the national team and to the talent development.

"The national team has now become a locomotive that hopefully can pull it all along. But there is still a lot to do. The most important thing is not that we have qualified for the World Cup. The most important thing is what we need to do so it's not 36 years before it happens again.”

Juan Carlos Oblitas was part of the team that won the Copa América in 1975 and played in the World Cup in 1978 and 1982. In 1996 he became the national coach and was in charge of the national team in the qualifiers for the World Cup in France, where the Peruvians missed out of the World Cup on goal difference after a painful 4-0 defeat in Chile in the penultimate game. Peru would not get any closer to the World Cup until Oblitas returned as the sporting director with the task of reversing decades of decline. "My generation actually killed two generations because we played the football we did,” Oblitas said. “People came to take it for granted. Those responsible believed that the Peruvian players would sprout up from the ground by themselves, as we did in my time. People thought that you should only add some intensity to Peruvian football. The rest was innate. Talent, creativity, good technique, skills.

"And while we stopped working, they worked hard on talent development elsewhere. We got more and more outdistanced. It's not as if we have now reinvented the wheel. What we are doing now, they have done in the other countries for a long time.

"Negativity became a culture. A habit. We have changed that into positivity and hope. I know it sounds very rhetorical, but that's the reality. We have a motto: ‘We before me.’ Nobody is indispensable. No! Here it’s all about the team. That was not the case before."

The sporting director smiles when he tells the story of how he signed up Ricardo Gareca as the new coach of the national team at the beginning of 2015. Today the appointment appears a stroke of genius, but at that time the Argentinian was not the obvious choice. Oblitas had met him as a player and then met him as a coach when Gareca in 2007 got a job in Peru for the first time as the head coach of Universitario, whom he led to the championship the following year. And Oblitas had subsequently followed Gareca's successful work at Vélez Sarsfield from a distance.

"We have previously had some periods when you had the impression that the players ruled it all within the national team and the gossip press created the team's agenda,” Oblitas said. “We had to get rid of all that. That's why we needed a proper football man. One who smells of football. One who smells of changing rooms. And one who works well in poverty, with limited means. I saw that Gareca lost two, three or four players each year at Vélez Sarsfield and yet he put a good team together the following season. He was the one we needed."

Initially the focus was more on putting together a team that could qualify for 2022. Russia seemed unrealistic. That's why he did not panic after the poor start of the qualifiers, as Peru only picked up four points from the first six matches. However, he was surprised by the coach's optimism. "A year ago, Gareca was there where you are sitting right now,” Obitas went on. “He said: ‘We’ll qualify.’ I looked at him, wondering. At that time, we were third from bottom. ‘But Ricardo, look at our position in the table.’ He did not care. ‘Now I have my team,’ he said.”

Peru went undefeated through the last eight World Cup qualifiers and the success took the observers of South American football unawares. It was not a consequence of Peru having better players than before – on the contrary. The biggest stars Paolo Guerrero and Jefferson Farfán are 34 and 33 years old and Guerrero will not play at the World Cup because of a doping ban. None of the new players in the national team play at big clubs in Europe.

"Ricardo has brought players forward who perform far better at the national team than at their clubs,” said Oblitas, who wants to take advantage of the national team’s success to develop Peruvian football as a whole. “Usually it’s the other way round. He has done a lot of mental work by convincing the players that they have nothing to fear from Argentina, Brazil and the other teams.

"Everything is completely different now. Now the national team has become the good example for the rest. The football has shown everyone that if the country works together as a team we can achieve something."

Still, there is a long way to go to fulfil Oblitas's hopes that the success of the national team will affect club football in Peru. The national league is in a pitiful state and Peruvian clubs are usually knocked out early in the Copa Libertadores.

Worst is the current state of the historic club Universitario. ‘La U’ is the most successful club in Peru’s history and plays its home matches at Estadio Monumental, which with a capacity of 80,000 is the largest stadium in South America. But the club is in both sporting and economic crisis. The players were not paid on time in March and as a result of the financial problems the club was not allowed to sign new players before the start of the season in mid-May.  In the qualification rounds of the Copa Libertadores, Universitario were humiliatingly knocked out by Oriente Petrolero, even though the Bolivian team had two players sent off in the second leg.

When Universitario visited Alianza Lima in April for the biggest derby in Peruvian football, there were violent clashes after the match between more than 100 followers of the two clubs. Bottles were thrown, guns were fired and a young man lost his life.

And when it comes to talent development, there are major shortcomings. It says a lot that the small club Academia de Cantolao in the shabby port city of Callao can challenge the much bigger clubs in the capital. "Cantolao has the best youth development in Peru,” said he midfielder Josimar Atoche, who once played for Alianza Lima but has recently returned to Cantolao.. “The big clubs are only getting more attention because they have more followers.”

The club was originally founded as a social project in Callao. A number of international players, Claudio Pizarro the most famous, have emerged from the club's youth department. In 2014, Cantolao turned professional and they now play in the top division. But resources are limited and they play home matches in front of a few hundred spectators in Callao.

"The difference is that the management of the other clubs is changing all the time,” said the club's legendary president Dante Mandriotti, who founded the Academia de Cantolao 37 years ago. “We are like a family here. It provides stability and continuity. That's the difference.”

A picture of something unusual is beginning to emerge: Peru’s success is not the result of a golden generation. Nor is it a result of a country's commitment to spending large funds on developing the nation's football talents. And it is certainly not a consequence of a boom in club football in the country.

The story of Peru's return is something different and more unusual. It is about the national team itself and the people around them. And all threads end up with Ricardo Gareca.

In a meeting room at Delfines Hotel in the San Isidro business district, he shakes hands and smiles kindly. A couple of months earlier, Ricardo Gareca turned sixty, but still he leaves his hair as long as when he kicked Argentina to the World Cup in 1985 and began the decline of Peru. He looks like an eccentric rock singer with his best years behind him, but Gareca is a man characterised by calm and reason.

"You cannot put the lid on the euphoria in Peru right now, and you shouldn’t,” he said. “It's a good thing that the euphoria is there and it's a beautiful moment for the country. Because people have many problems in their daily life. Hopefully, we can keep giving them joy.

"But we around the team have to get out of the euphoria and live in the real world. At the World Cup, a new reality is starting and we need to adapt and to do so fast. If you ask me what I want for the World Cup, I would say that beyond the results we want to consolidate a way of playing. So that the world can say when they see Peru: 'Peru is playing in a particular way.' That's important to me.

"I like the Peruvian players. I am convinced of their potential and I fully believed we were able to achieve what we wanted. Not that we would necessarily qualify for the World Cup but that we would acquit ourselves well and fight for our opportunities until the end.

"From my time at Universitario, I knew about the country and the quality of the players. Unfortunately, the country does not offer anything to the players. The Peruvian players have become what they are through the strength they possess. Imagine another situation where they get schooled, from the age of eight or ten, just like anywhere else in the world. Where they have a guarantee of good football training and where they know that there is a good infrastructure. In Peru there is nothing. Nada!

"Under these circumstances, it's a big triumph what the Peruvian players achieve. And this team has the desire to surpass itself every day. Sometimes you get the impression that one can only achieve excellence by having terrific players. But a lot of times players of good quality can form an excellent team. And the results have made the players more and more convinced that we are doing the right thing. Standing together and creating a united squad and transmitting it onto the pitch. It's an intelligent team.

"Our style of play is about transferring Peru’s historical identity with good technical players to the current dynamic of international football. If we can transfer the quality of our game to the intensity required by a World Cup, we have come a long way. We succeeded in doing just that in the qualification and if we can repeat it at the World Cup, it can give us a result.”

Ricardo Gareca has evolved into a national role model in Peru. For decades, one coach after another has tried to wake up the sleepy football nation. Gareca has proven to have the right qualities. He appears a rational and trustworthy man. He is intense without being a seducer. He is demanding of his players but shows them confidence at the same time. He understands Peru’s football culture but is not a slave of history. He has managed to get all the pieces to fit together and has created a sum that is far greater than the individual parts. And he has reached a culmination before the foundation was even moulded in Peruvian football.

Personally, he has achieved a late breakthrough in his career as a coach and will now go to the World Cup, which he never did as a player. Although he scored the crucial goal against Peru in the qualifiers in 1985, he was not included in the squad the following year when Argentina won the World Cup in Mexico. "Some say there's a reason that the story has happened like this,” he said. “That it's fate that I'm going to the World Cup as the coach of Peru. But I do not see it like that. These are different situations. And I've never felt any bitterness from the Peruvians. Never. At that time, I represented Argentina. Now the situation is different.”