A series of Chavez left hands early in the final round knocked Martinez down, and had him badly hurt but the challenger returned fire and hung on to reach the final bell in a fight that, until the knockdown, he had been dominating.
"Julio fought a great fight," Martinez said. "He showed he had heart right until the end."
Until the final round, the 37-year-old Martinez, 50-2-2 (28 KOs), was far too fast and skilful for Chavez, 46-1-1 (32 KOs).
He bloodied his opponents' nose and closed his left eye with southpaw right jabs and straight left hands, and progressively weakened him with left hands to the body.
For his part, Chavez seemed intent on attempting to pin the smaller Martinez in a corner or against the ropes and dig to the body with hooks and uppercuts.
But each time it appeared he might be starting to turn the momentum in his favour, Martinez would respond, repeatedly succeeding in spinning away or returning fire.
"I was 20 seconds away from knocking him out," Chavez said. "I started way too late. Going into the fight, I thought I was going to be able to do all night what I did in that final round.
"A rematch is justified."
On the undercard, Roman Martinez claimed the vacant WBO super-featherweight title with a split decision win over Miguel Beltran Jr, while Guillermo Rigondeaux retained his WBA super-featherweight crown with a lopsided points victory against Robert Marroquin.
Over at the MGM Grand Garden, Saul Alvarez defended his WBC 154-pound title and stopped Josesito Lopez in the fifth round.
Jhonny Gonzalez was defeated as Daniel Ponce de Leon won a unanimous points decision to become the new WBC featherweight champion, while Leo Santa Cruz also defended his IBF bantamweight title by stopping veteran Eric Morel, who quit on his stool after the fifth round.
Meanwhile, Matthew Macklin restored his position as a middleweight title contender with a ruthless stoppage of Canadian Joachim Alcine in Las Vegas.