There were candlelit vigils not just outside the hospital in Buenos Aires but around the world. After spending 12 days in critical care with heart and lung problems, Diego Armando Maradona was lying among the patients in a psychiatric ward while his family argued about further treatment. "They were all crazy in there," he later recalled. "One guy said he was Napoleon and they didn't believe him. I said I was Maradona and they didn't believe me, either."

The ultimate sequel to that episode, currently playing out in South Africa, would stretch anyone's credulity. In 2004, as the world awaited the news of his death at 43 from a combination of physical problems provoked by the ravages of fame, his spectacularly turbulent existence had reached its lowest point. But six years later, against all the odds and expectations, he is once again dominating the World Cup, the competition in which he experienced his hours of greatest glory and infamy.

Even at this quarter-final stage, his renaissance as Argentina's head coach is the story of the year. Should he go on to guide his team to three more victories and see his captain, Javier Mascherano, lift the trophy that he himself held aloft in 1986, it will forever be seen as one of the most remarkable comebacks in the entire history of sport.

The latest chapter of his saga began in November 2008, when he landed in Glasgow to start his new life with a friendly match against Scotland at Hampden Park – where, 29 years earlier, he had scored his first international goal. "If I hadn't accepted the offer I would have been a coward," he told a press conference. "We have a long, hard road ahead of us. It's not going to be easy, but the team needed someone to guide and help them, and now we're on a mission together."

Few imagined that the mission would achieve its aim. At that point the sum total of Maradona's coaching experience amounted to 23 matches in charge of Deportivo Mandiyú of Corrientes and Racing Club of Buenos Aires. The first, in 1994, ended in relegation and the second, the following year, in chaos. So no one knew what to expect when he was suddenly appointed to take over from Alfio Basile midway through the World Cup qualifying campaign, except the near-certainty of further chaos.

In Glasgow he was asked if he would be indulging in the sort of antics seen from him at the 2006 World Cup in Germany when, in a rather grotesque sideshow, he became a sort of cheerleader to the team. "It depends on how the team are playing," he said. "If they're making me feel safe and sound, I'll be fine. If they're making me nervous, then maybe I'll behave like you saw in Germany."

His team won their first three matches, but a 6-1 defeat at the hands of Bolivia at 3,657 metres (12,000ft) in La Paz – as heavy as any in Argentina's history – left them lying fifth in the 10-team Conmebol group, from which four countries would qualify automatically. It was for the next game, a 1-0 victory at home to Colombia, that he courted ridicule by bringing the then 34-year-old Juan Sebastián Verón into the starting line-up, and after three further defeats they were still stranded in fifth place, with two matches to play.

There were only 38,000 spectators in Buenos Aires's Monumental stadium, which holds almost twice that number, when Argentina played Peru in the first of those crucial fixtures last October, but those who had kept faith were rewarded with a moment of matchless melodrama amid a rainstorm of tropical proportions.

After Martín Palermo, the veteran Boca Juniors striker, had come off the bench to score the winner in the second minute of stoppage time, Maradona celebrated victory with a belly-slide along the sodden touchline. Four days later, after Mario Bolatti, another late substitute, had scored in the 84th minute in Montevideo to secure victory over Uruguay and the final automatic qualifying place, he directed an obscene tirade at the media.

For that outburst he received a two-month ban from all football activity and a fine of 25,000 Swiss francs (£15,400) from Fifa. His critics were given further ammunition when his squad for South Africa contained neither Esteban Cambiasso nor Javier Zanetti, two vastly experienced internationals who had just helped José Mourinho's Internazionale win the Champions League. Together with Maradona's preference for the ageing Verón over Juan Román Riquelme, the widely adored playmaker who has never been included in his selections, this was seen as a further sign of his unfitness for the job of leading Argentina to their first World Cup victory since his own annus mirabilis of 1986.

The method to his apparent madness has become apparent over the past three weeks. "What Maradona did first when he took over," an Argentinian journalist said this week, "was to nominate the key man in his side. That was Mascherano. He actually said, 'The team will be Mascherano and 10 others.' And when he selected the squad of 23 to go to South Africa, he divided it very clearly into two: there would be the 11 players of the side, plus 12 supporters."

What this means is that the players on the bench are chosen for their ability to buy into the team ethic as much as for their skills – just as Clive Woodward, before the 2003 rugby World Cup, convinced his reserves that although they were virtually certain never to appear in the tournament itself, their presence was no less vital to the success of the enterprise than that of the members of the XV. Maradona did not want a substitutes' bench – or the team's hotel in Pretoria – containing players who would resent their enforced inactivity. Hence, by deduction, the absences of Cambiasso, Zanetti and a few others.

Another significant piece of man-management has taken place at the tournament, and has involved Lionel Messi, by general consent the best player of his generation, as Maradona once was. Their relationship was sticky at the start, the head coach seeming to believe – like the majority of his compatriots – that Messi's heart belongs to Barcelona, where he was taken at the age of 13, rather than to Argentina.

Since arriving in South Africa, however, Maradona has taken every opportunity to sing the praises of his latest heir to the No10 shirt, speaking not only of his talent but of his charisma and serenity. When Mascherano was rested, for the third group match against Greece, the 23-year-old Messi was given the captain's armband.

After the 3-1 win over Mexico, Maradona repeated his frequent call for referees to provide better protection for his new favourite. "Whenever Messi has the ball everyone is trying to kick his legs," he said. "What is being done to him is a scandal. I lived through that 20 years ago. I understand why the Mexicans did it, but there is a limit to everything."

On the pitch at the University of Pretoria's High Performance Centre this week a couple of hundred journalists watched Maradona leading his players through a high-spirited practice match, 11-a-side on a half-sized pitch, with the head coach not only refereeing but delivering a constant running commentary. He spotted the ball for Messi when a penalty was awarded, and after Carlos Tevez missed one at the other end the Manchester City striker was forced to join the coaches in the goalmouth for the daily ritual in which the squad are invited to unleash a simultaneous volley of shots at them from the edge of the area, hitting the ball as hard as they like. Maradona himself took a particularly ferocious strike from Mascherano on the back of the head, without evident damage to the relationship between head coach and captain. On this particular evening, however, Maradona denied himself the large Havana cigar which he sometimes lights up as he leaves the training ground.

What the reporters were not allowed to see was the real work going on, including the meticulous preparation of the set-piece routines that delivered the team's first three goals of the tournament. A group of assistants including Héctor Enrique, who likes to remind people that it was he who passed Maradona the ball to start the run for that second goal against England 24 years ago, are earning their money while the head coach astutely absorbs the attention and deflects the pressure.

The contrast with other coaches at this World Cup is almost hilariously vivid. But then none of them has lived a life remotely like his. It is as though everything in Maradona's 49 years, the bad and the good, the sublime and the reprehensible, has been leading up to this, and he is not going to let it go now.

• This article was amended on 6 July 2010. The original referred to Martín Palmero. This has been corrected.