Manchester City kept up their unbeaten start to the Premier League season with victory over QPR in an entertaining see-saw encounter at Loftus Road.
Rangers began well and led through Jay Bothroyd's header but Edin Dzeko fired City level just before half-time.
David Silva slotted City ahead, but QPR hit back when Heidar Helguson deflected in Bothroyd's header on the line.
The visitors rallied again though and struck decisively 16 minutes from time when Yaya Toure headed in the winner.
City have lapped up the plaudits this season for a series of handsome wins but manager Roberto Mancini has demanded that his side also learn to grind out results when they do not play well. He now has an example to point to.
Mancini's men were far from their best but dug in to earn a 10th win in 11 league games and an eighth successive victory in all competitions to maintain their five-point lead at the top of the table.
Great news for City, but the result was harsh on Neil Warnock's side who gave as good as they got even though the odds were stacked against them.
Despite of the absence of Shaun Derry and Adel Taarabt because of illness and injury respectively, the home side began superbly. Helguson twice threatened early on with shots from the right-hand corner of the box before Anton Ferdinand spurned a great chance at the back post following the Icelandic striker's header back across goal.
The home side continued in this vain and were rewarded in the 28th minute when Bothroyd rose highest to head in Joey Barton's curling free-kick from the right.
It could have been much worse for City before the break, but goalkeeper Joe Hart saved Jamie Mackie's long-range shot and Helguson's headed follow-up - although the latter was offside - before Bothroyd hit the post with another header.
However, even when they are not playing well, City's quality ensures they remain a threat and they demonstrated this with aplomb two minutes before half-time.
QPR defender Ferdinand had earlier denied Dzeko with a superb block, but this time the striker got the better of the defender, cutting inside him after being found by Milner down the right, and firing in low past Paddy Kenny.
It would have been harsh on the home side, but City could have led at the break had a post not denied Sergio Aguero's 25-yard strike.
Early in the second half City did lead when Silva neatly took Dzeko's cross from the right in his stride before lashing the ball past Kenny.
The game now swung in the favour of the visitors and it seemed just a matter of time before they scored again.
It is testimony to QPR's spirit then that it was they who next found the net as Bothroyd's goalbound header from an Armand Traore cross ultimately found the net courtesy of the back of Helguson, who was on the goalline but - despite the protestations of a number of City players - not offside.
Toure would have the decisive say though, rising high to power a header past Kenny from Aleksandar Kolarov's cross.
QPR would have one more chance to salvage a point but the bar denied Helguson with a late header and the points went to City.
Queens Park Rangers manager Neil Warnock:
"We were organised and took the game to them, and I think we played some cracking football. It was the width of the post on a couple of occasions.
"The crowd were great, but we got punished by quality players. They came down here today, some of the foreign lads, maybe not aware of us. I thought it was a great game of English football.
"We thought, 'If we're going to get beat, we might as well have a go at them and get beat.'
"We can improve, but we've shown a lot of people today what we can do."
Manchester City coach David Platt:
"Perhaps we weren't at our sharpest, what with all the travelling midweek and a few knocks as well.
"We didn't have that brightness in our play. The important thing is that when we are not at our sharpest we can still go on and take the three points.
"One clean sheet in seven is a by-product of the way we play. Last season we had the best defensive record in the division. If you're as offensive as we are then we're going to be open to one or two things. The manager's a perfectionist and he'll be looking at that."