You are not permitted to download, save or email this image. Visit image gallery to purchase the image.
The 39-year-old Mexican, who had lost twice and drawn once in their three previous meetings, sent Pacquiao crashing to the canvas with a stinging right hand with one second left in the round at the MGM Grand Garden Arena.
The Filipino southpaw fell face first and remained motionless for several minutes before finally getting up, smiling at Marquez and then shaking his opponent's hand in middle of the ring.
"We knew it was going to be a very difficult fight but we knew it was possible to win," a beaming Marquez said ringside after improving his record to 55-6-1 with 40 knockouts.
Pacquiao, who had been knocked down in the third round, sent Marquez to the floor in the fifth and looked to be getting the better of the fight until the stunning knockout.
"He's not an easy opponent," Pacquiao said after slipping to 54-5-2 with 38 knockouts.
"I did my best. I know that I got him in the last couple of rounds but I started to be over-confident and I got hit by a solid punch. I did not expect that punch."
Asked if he would like to fight Marquez for a fifth time, Pacquiao replied: "Yes, why not? It's a good fight."
Watched by a sell-out crowd of 16,000 that included former heavyweight champion Mike Tyson and basketball great Magic Johnson, the two fighters made an energetic start with Pacquiao establishing a slight advantage through his lightning left jabs.
The Filipino caught the Mexican on the chin with a crunching left in the second round and dominated early in the third with his nimble footwork before he was stunningly sent to the canvas by a Marquez right hook.
It was the first time Pacquiao had been knocked down by Marquez in 39 rounds contested by the fighters.
The Filipino responded with a flurry of combinations in the fourth round, then dropped Marquez with a straight left in the fifth and the Mexican ended that round with a bloodied nose after being pinned against the ropes.
Pacquiao continued to dictate the pace, repeatedly forcing the Mexican to back-peddle before the Filipino was stunningly knocked out late in the sixth round by a rasping Marquez right.