Loading...
The Group E encounter had looked set to finish 0-0, hardly a surprise given Ecuador's incredible defensive record during qualifying, and that result may well have suited both teams.
But the 23-year-old Diallo, who had been introduced in place of Bazoumana Toure shortly before the hour mark, had other ideas as he finished first-time from a right-wing cross right just as the game was heading for injury time.
It is Ivory Coast's first win at a World Cup in exactly 12 years, since they beat Japan in Brazil in 2014, and they can now be confident of making the knockout phase at the tournament for the first time.
It was a disappointing way to start for Ecuador, who had the majority of the 68,274 crowd at the packed Philadelphia stadium kitted out in yellow and backing them.
They hit the bar twice in the first half, through John Yeboah and Alan Minda, while Elye Wahi struck the same crossbar for the Ivorians after half-time.
Ivory Coast, African champions in 2024, will now hope to build on this when they play Germany in their next game in Group E in Toronto on Saturday.
The Ecuadorians will look to bounce back when they head to Kansas City the same day to play Curacao, the debutant minnows who were hammered 7-1 by Germany earlier in Houston.
Ecuador, coached by Argentinian Sebastian Beccacece, had a remarkable record in South American qualifying as they finished second behind Argentina.
With a defence marshalled by Paris Saint-Germain's Willian Pacho and Chelsea's Moises Caicedo patrolling the midfield, they conceded a miserly five goals in 18 qualifying games, but scored only 14.
Remarkably, eight of their 18 matches ended in 0-0 draws, and six featured a single goal.