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.
DID YOU KNOW?
Manchester City have now become the fifth club in the English top-flight to win at least 10 of the first 11 matches of a season. Of the seven previous occasions this has happened, only Liverpool (1990/1991) and Manchester United (1985/1986) failed to win the title.
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."
Live Text Commentary
Full Time The final whistle is blown by the referee.90:00 +2:27
Corner from the left by-line taken by Joey Barton, Headed effort from deep inside the area by Heidar Helguson misses to the right of the goal.90:00 +1:37
Foul by Jason Puncheon on Mario Balotelli, free kick awarded. James Milner takes the direct free kick.90:00 +0:31 Substitution
Substitution Clint Hill is brought on as a substitute for Armand Traore.90:00 +0:31
Alejandro Faurlin produces a left-footed shot from outside the box and misses left.89:20
Mario Balotelli has an effort at goal from a long way out that misses to the right of the goal.87:17 Substitution
Substitution Kolo Toure on for Edin Dzeko.83:15 Substitution
Substitution Tommy Smith comes on in place of Jamie Mackie.81:43
Heidar Helguson takes a shot.81:03
Free kick awarded for a foul by James Milner on Shaun Wright-Phillips. Direct free kick taken by Joey Barton.80:19
Aleksandar Kolarov takes the direct free kick.80:19 Booking
Booking Joey Barton is booked.80:12
Joey Barton gives away a free kick for an unfair challenge on David Silva.78:59
Effort from the edge of the box by David Silva goes wide of the left-hand post.77:25
Direct free kick taken by Patrick Kenny.77:25 Booking
Booking Mario Balotelli receives a yellow card.75:52 Substitution
Substitution Jason Puncheon replaces Jay Bothroyd.75:35
Mario Balotelli takes a shot. Luke Young gets a block in.75:01
Free kick awarded for an unfair challenge on Daniel Gabbidon by Mario Balotelli. Free kick taken by Patrick Kenny.74:21 Substitution
Substitution Mario Balotelli on for Gareth Barry.
Assist by Aleksandar Kolarov.73:21 Goal scored
Goal! - Gnegneri Toure Yaya - QPR 2 - 3 Man City Gnegneri Toure Yaya grabs a headed goal from inside the penalty area. QPR 2-3 Man City.71:25
Free kick awarded for an unfair challenge on Aleksandar Kolarov by Jamie Mackie. Free kick taken by Joe Hart.68:05
Assist by Jay Bothroyd.68:05 Goal scored
Goal! - Heidar Helguson - QPR 2 - 2 Man City Heidar Helguson finds the back of the net with a goal from close in high into the middle of the goal. QPR 2-2 Man City.68:02
Jay Bothroyd takes a shot. Heidar Helguson gets a block in.67:05 Substitution
Substitution Sergio Aguero leaves the field to be replaced by Adam Johnson.66:20
Shot by Heidar Helguson from inside the six-yard box clear the bar.66:08
Joey Barton takes a shot. Blocked by Gareth Barry.65:26
Heidar Helguson takes a shot. Blocked by Stefan Savic.63:33
Free kick awarded for an unfair challenge on Alejandro Faurlin by Gareth Barry. Joey Barton takes the direct free kick.59:19
Edin Dzeko takes a shot. Patrick Kenny makes a save. Sergio Aguero produces a right-footed shot from just outside the penalty box that misses to the left of the target.58:51
Shot by Jay Bothroyd from outside the box goes high over the crossbar.58:27
Free kick awarded for a foul by Micah Richards on Shaun Wright-Phillips. Shaun Wright-Phillips restarts play with the free kick.57:18
Joey Barton takes a shot. Blocked by Stefan Savic.56:08
Shaun Wright-Phillips is flagged offside by the assistant referee. Free kick taken by Joe Hart.55:50
Sergio Aguero is ruled offside. Indirect free kick taken by Luke Young.54:49
Sergio Aguero has an effort at goal from just inside the box that misses to the right of the goal.54:00
Edin Dzeko has an effort at goal from just inside the box that misses to the right of the goal.51:32
Assist by Edin Dzeko.51:32 Goal scored
Goal! - David Silva - QPR 1 - 2 Man City Goal scored by David Silva from close range to the bottom left corner of the goal. QPR 1-2 Man City.49:54
The offside flag is raised against Edin Dzeko. Patrick Kenny takes the indirect free kick.46:46
Effort on goal by Joey Barton from long range goes over the crossbar.46:17
Sergio Aguero concedes a free kick for a foul on Anton Ferdinand. Patrick Kenny takes the direct free kick.45:45
Free kick awarded for an unfair challenge on Jay Bothroyd by Gnegneri Toure Yaya. Daniel Gabbidon takes the direct free kick.45:18
Joey Barton takes a shot. Joe Hart makes a save.45:01
The referee blows his whistle to start the second half.45:00 +1:06 Half time
Half Time It is the end of the first-half.44:39
Sergio Aguero produces a shot from just outside the box that bounces off the post.44:03
Aleksandar Kolarov takes a shot. Blocked by Armand Traore.42:31
James Milner provided the assist for the goal.42:31 Goal scored
Goal! - Edin Dzeko - QPR 1 - 1 Man City Edin Dzeko grabs a goal from inside the area to the bottom left corner of the goal. QPR 1-1 Man City.40:01
Free kick awarded for a foul by Luke Young on Sergio Aguero. Aleksandar Kolarov has a direct shot on goal from the free kick.39:12
Jay Bothroyd produces a header from close range which bounces off the post.38:46
Unfair challenge on Jay Bothroyd by Gareth Barry results in a free kick. Free kick taken by Luke Young.36:14
Foul by Stefan Savic on Jay Bothroyd, free kick awarded. Joey Barton delivers the ball from the free kick right-footed from right wing, Stefan Savic makes a clearance.34:16
Sergio Aguero takes a shot. Save by Patrick Kenny.33:22
Jamie Mackie takes a shot. Joe Hart makes a save. Heidar Helguson is flagged offside by the assistant referee. Joe Hart restarts play with the free kick.28:41
Edin Dzeko takes a shot. Anton Ferdinand gets a block in.27:27
Joey Barton provided the assist for the goal.27:27 Goal scored
Goal! - Jay Bothroyd - QPR 1 - 0 Man City Jay Bothroyd scores a headed goal from inside the six-yard box. QPR 1-0 Man City.26:43
Aleksandar Kolarov gives away a free kick for an unfair challenge on Jay Bothroyd. Joey Barton produces a cross,26:19
Gareth Barry gives away a free kick for an unfair challenge on Daniel Gabbidon. Direct free kick taken by Joey Barton.22:52
Outswinging corner taken by Joey Barton from the right by-line, Header from close in by Heidar Helguson misses to the right of the target.22:17
Free kick awarded for an unfair challenge on Heidar Helguson by Stefan Savic. Joey Barton restarts play with the free kick.20:17
Free kick awarded for an unfair challenge on Alejandro Faurlin by David Silva. Patrick Kenny takes the free kick.14:48
Heidar Helguson takes a shot. Save by Joe Hart.13:42
Short corner taken by James Milner from the right by-line.7:40
Inswinging corner taken right-footed by Joey Barton from the left by-line, Micah Richards makes a clearance.6:01
Luke Young concedes a free kick for a foul on Aleksandar Kolarov. Direct free kick taken by Aleksandar Kolarov.3:27
Foul by Edin Dzeko on Anton Ferdinand, free kick awarded. Patrick Kenny takes the direct free kick.2:57
Heidar Helguson produces a volleyed right-footed shot from deep inside the penalty box which goes wide of the left-hand upright.2:14
Gnegneri Toure Yaya gives away a free kick for an unfair challenge on Jay Bothroyd. Armand Traore takes the direct free kick.1:07
Shot by Gareth Barry from outside the box goes over the net.0:00
The ref blows the whistle to begin the match.
Live data and text provided by our data suppliers