Martinez became the second player this season and just the 18th in Major League Baseball history to achieve the milestone.
"It's one of those things. When you're seeing the ball well and you hit the ball," said Martinez, who joined the Diamondbacks in July via a trade with the Detroit Tigers.
Martinez was four-for-five with six RBIs in front of a crowd of 47,200 at Dodger Stadium. He hit his 34th home run of the year in the ninth off pitcher Wilmer Font after also going long in the fourth, seventh and eighth innings.
He said he was trying not to think too much about making history with his at-bats against the struggling Dodgers.
"Shocked, no," he said. "I don't think someone goes up there not trying to hit the ball hard. I was just happy it went over (the fence)."
The 30-year-old Martinez flirted with the magic number four once before in 2015 when he hammered three home runs in a game. That experience helped him Monday, he said.
"I got to my last at-bat (in 2015) and I started thinking about it and that's when it didn't happen," he said.
"In this at-bat, I came up and said, 'You know what? Just go up here and try to have a good at-bat. Keep doing what you've been doing all day. If it's meant to be, it's meant to be.
"There's no point in forcing it. "Have a good at-bat.' That's what I was telling myself."
Martinez's homer surge was just part of an all-around strong game for Arizona.
Pitcher Robbie Ray had a career-high 14 strikeouts. The Diamondbacks hit six home runs in the rout, handing the Dodgers their ninth loss in 10 games.
The Diamondbacks have scored five or more runs in eight consecutive games.