The home team started dangerously and led through Charlie Daniels’ superb half-volley from the corner of the area on 12 minutes.
City were level on 21 minutes.
David Silva threaded the ball through to Gabriel Jesus, who finished for his first goal of the season.
Thereafter City largely dominated, although Joshua King hit a post on 61 minutes.
Nicolas Otamendi also hit the woodwork but just when it looked as if it would end a draw, City broke and Sterling’s deflected shot found the corner of the net.
Sterling then was sent off for a second yellow card after celebrating with the away fans.