Lyles (2-4) snapped his personal three-game losing streak by allowing six hits and one run in 6 1/3 innings, pitching around four walks. The only run scored against Lyles was on a third-inning home run by Will Venable that was originally ruled a triple before being overturned via instant replay.
The Astros got a home run from Jed Lowrie in the third inning to tie the game before scoring four times against San Diego starter Kip Wells in the fifth after the right-hander committed a throwing error that was extremely costly.
With a runner at first base and one out, Wells made a nifty behind-the-back stop on a grounder off the bat of Brian Bogusevic before turning and firing an errant throw into center field. Instead of a potential inning-ending double play, the Astros were in business, the big inning capped by Martinez's long two-run homer to left-center that made it a 5-1 game. Wells was making his first Major League start since 2009.
"I'm just happy that I was able to contribute and make an impact in the game," Martinez said. "That's always what you want to do, and I always try to make a difference, anything you can do to help the team win."
Martinez, who is second to Lowrie with 10 home runs, has three long balls and eight RBIs in his last four games and leads the team with 45 RBIs. He's on pace for 22 homers and 99 RBIs, which is surprising considering he had only nine RBIs in the month of June.
"I think the way he's swinging the bat, the way he's carrying himself [is different]," Mills said. "He's getting back into that hitter that we all saw last year, and that's nice to see. He's on a little roll here and we're surely hoping that can continue."
Martinez said he's simply not missing as many pitches.
"Now, every time I get back from an at-bat, I look at my bat and most of the ball marks are right around the barrel, which is a plus for me," he said. "I feel like I've been battling off the end and off the handle, and then every now and then I hit one off the barrel. I feel like this homestand I've found more pitches and hit more pitches off the barrel."
The Padres had the bases loaded three times -- in the second, third and ninth -- and couldn't come up with a clutch hit in those situations. They were 2-for-11 with runners in scoring position, rallying for a pair of runs in the ninth inning off David Carpenter on a two-run single by Chase Headley.
Brett Myers, working for the third game in a row, gave up two hits, including the Headley single, and hit a batter to load the bases before getting the final out for his 17th save.
"It's frustrating," Padres manager Bud Black said. "You're looking for one big knock. The Astros probably said the same thing last night. They had a couple opportunities. There's somebody on the other side of that diamond trying to prevent it as well."
Lyles watched the Padres load the bases in the second on a one-out error by third baseman Chris Johnson and a pair of singles, but he retired the eighth and ninth hitters in the order to escape. After Venable tagged him for a homer in the third, Lyles gave up two one-out singles and a two-out walk to load the bases for Alexi Amarista, who grounded out to end the inning.
"For the most part, when it came down to it, when guys were on second and third, I made a pitch or two here," Lyles sad. "Jason [Castro] was behind the plate and called a great game and made it easy on me. The third inning was very taxing and it was big to come back in the fourth-inning and get less than a 10-pitch inning."
Lyles was pulled after allowing a walk and a single in the seventh inning, and Fernando Abad threw 1 2/3 scoreless innings to get the game to the ninth at 5-1.
"It's nice to see Jordan get some reward," Mills said. "He's been throwing the ball extremely well for us. He wasn't as crisp as he has been, and he picked it up as he went along. It was nice to see him to do that."
The Astros have scored 27 runs in their past four games (hitting .294 as a team in that span), which equals their run total in their previous 10 games.
"We've swung the bats really well lately, and I think the biggest thing is just continuing to refine the approach so we can be more consistent," said Lowrie, whose 14 homers are tied for the second most by an Astros shortstop in a season. "You're going to run into some good pitching every once in a while, but with more experience and a more refined approach, you can be more consistent with your offense."