Pedrosa, nursing a badly injured hip from a crash he blamed on a collision with Marquez that ended his race in Aragon two weeks ago, made a point to his Honda team mate with a dominant ride to claim his third victory of the season.
Marquez, though, prevailed in a fierce battle with his closest title rival, world champion Jorge Lorenzo, and passed the Yamaha rider with 11 laps remaining to claim the 20 points awarded for second place.
Victory for Marquez next week at Phillip Island in Australia combined with anything worse than second place for Lorenzo, who finished third ahead of Valentino Rossi, would hand the 20-year-old the world title with two races to spare.
Marquez said claiming the points for the championship race at the sweeping Sepang International Circuit had been more important than pushing for a seventh victory of the season.
"We had a great battle with Jorge and Dani opened up this gap," he said.
"And when I overtook Jorge, I tried to close this gap but it was too much risk.
"So I said, 'Okay, I will finish second, I will lead with 43 points and that is enough after the Malaysian Grand Prix'."
With three rounds to go and a maximum of 75 points up for grabs, Marquez leads the riders' standings on 298 points with Lorenzo second on 255 and Pedrosa third with 244.
Marquez was handed a third penalty point of the season for his part in the Aragon collision but Pedrosa still clearly felt he had something to prove and raced off the second row past the pole-sitter at the start.
Lorenzo, aware that he would become less competitive against his compatriots on the Hondas as the race progressed, made an even better start and led until he was overtaken by Pedrosa on lap five.
Marquez almost followed his team mate through but Lorenzo held his ground in a ding-dong battle until lap nine, when the championship leader came storming up the inside.
By this time, though, Pedrosa had already established a strong lead and he crossed the line an impressive 2.757 seconds ahead of the field.
"Great feeling to be back and to win this race after the huge crash, physically it was very hard," said the 28-year-old.
"It was not an easy week, I wasn't really able to get out of bed but came back strong to win this one for my fans and for my team.
"It's a little bit of a shame because I had very strong pace in Aragon too, we could have won but unfortunately I crashed."
- Sports & Recreation
- Motor Racing
- Jorge Lorenzo