The right-hander struck out nine and walked none in six innings. He retired 11 in a row after giving up a single to Freddie Freeman in the first, but he didn't get the decision.
Scherzer said his hamstring tightened up during warm-ups before the first inning.
"I didn't injure it; I just knew it was tight," he said. "There's times where it just happens and you just got to work around it. You might not be able to step on every fastball the same way, but you can still pitch."
He added: "I've had this in the past and you just get the treatment on it, listen to the trainers and do what they want you to do with it. In the past, I've always been able to make my next start, and I think I'll definitely be able to make my next start, going back out there."
With Wednesday's win, the Dodgers moved into sole possession of the NL West lead after the San Francisco Giants lost 5-2 to the Milwaukee Brewers. Los Angeles hadn't been in first place since April 25.
The Associated Press contributed to this report.