Nasri scored the only goal four minutes from the end of a pre-season friendly which seemed destined to end goalless after Yaya Toure had earlier hit the bar.
Sterling, a £49million signing from Liverpool this week, was not involved and was jeered – rather than cheered – when he was pictured on the giant screens in the stadium in the 15th minute.
The Premier League side were fortunate not to concede at least once to their Australian sister club after Stefan Mauk missed an open goal and Harry Novillo fired just wide in the second half.
Like Sterling, fellow forwards Sergio Aguero, Eden Dzeko and Wilfried Bony were not involved and Pellegrini started the game without a recognised first-team striker.
Manuel Garcia started furthest forward in a team that featured Toure, Vincent Kompany, Nasri and Jesus Navas, who all played the full 90 minutes.
Pellegrini also started several young talents including defenders Pablo Maffeo and Cameron Humphreys and midfielder Brandon Barker.
But it was the old heads who had the best chances in the opening period with Toure rattling a superb free-kick off the bar from 25 yards in the 20th minute, while Nasri dragged an effort wide nine minutes later before Navas shot from a tight angle, forcing a good save from Tando Velaphi.
Melbourne City should have opened the scoring when Robert Koren fed the ball across goal and Mauk had a simple tap-in to an open goal from six yards out, but the 19-year-old somehow conspired to put the ball wide.
With Joe Hart among the players left out, Willy Caballero started in goal and was forced into a fine fingertip save from Novillo’s rasping effort from outside the area shortly before the break.
Substitutions disrupted the flow of the second half and chances were at a premium until the 69th minute when Novillo dragged the ball past substitute James Horsfield and dinked the ball past Caballero only to see it trickle wide.
He was made to pay late on in the game when Nasri superbly controlled a cross from the right on his chest and with the ball bouncing slightly behind him, recovered his feet to drill an unstoppable shot past Velaphi.
With Sterling left in the stands and fellow summer signing Fabian Delph set to fly out to join his new team-mates later in the week, Pellegrini did treat supporters to a first sight of 18-year-old Turkey striker Enes Unal in the dying stages after his £2m arrival from Bursapsor.
Manchester City’s pre-season tour continues with International Champions Cup matches against Roma on Tuesday and Real Madrid on Friday.