The Tour of Lombardy winner kicked clear of his rivals in the closing kilometres before taking victory at the summit of Mentougou Miaofeng mountain.
Martin missed out on taking the overall lead by three seconds.
Though he picked up a 10-second bonus for his stage win, overnight race leader Philippe Gilbert (BMC Racing Team) was able to hold the lead jersey courtesy of the four-second bonus for third.
But the 28-year-old Irishman was thrilled with his efforts.
“I’m just happy to win the stage — the general classification would have been a bonus,” said Martin. “My teammates rode incredibly all day. All week they’ve been riding incredible. It’s unfortunate to miss out on the overall and obviously anything can happen tomorrow but other than bad luck, I think Philippe’s got the title. I’m still happy with second place.”
The other Irishman in the race, Philip Deignan (Team Sky), also impressed, finishing 17th, to move 19th overall in the standings.
Today’s final stage takes the riders from Tiananmen Square to the Bird’s Nest Plaza. If Martin is to win outright he’ll probably need to win the stage again and hope Gilbert is outside the top three. But the chances of that, on a sprinters’ course, are slim.