The loss snapped the Astros' three-game winning streak and was their first game this season decided by two runs or less.
"That's a tough loss, but at the same time Albert Pujols is Albert Pujols," Astros manager Bo Porter said. "He's one of the best players in our game for a reason, and he got a big hit for his ballclub tonight."
Pujols, who was a career .311 hitter against the Astros with 42 homers and 115 RBIs in 655 at-bats entering this season, turned on a Jose Veras pitch and shot it inside third base to score Luis Jimenez and Mike Trout to snap Los Angeles' five-game losing skid.
"The pitch was what I want and he hit it down the line," said Veras, who was pitching in a save situation for the first time this year. "You can't do nothing about it. He was a little jammed, but he's a strong guy and the ball got out on his bat."
The Angels were 0-for-4 with runners in scoring position prior to Pujols' double.
"We needed that," Trout said. "Things were going bad for us the past couple games, and that was a big hit for Albert."
Behind a strong outing from starter Lucas Harrell and a two-run homer by Chris Carter, the Astros carried a 4-1 lead into the eighth inning. The Angels scored twice in the eighth, getting a run when J.D. Martinez dropped a fly ball near the right-field line with one out and cutting the lead to 4-3 on a sacrifice fly by Chris Iannetta.
"It was a crucial play," Porter said of the Martinez drop. "J.D. went hard after it, he went all the way and the ball hit off his glove. He wasn't able to make the play and I've seen him make that play many times. I'm sure he's upset at himself for not making the play, but that's part of the game."
Martinez had to make a long run and was worried about hitting the wall.
"I wanted to secure [the ball], and I pulled it in a little too quick and it hit off the tip of the glove," Martinez said. "I was trying to bring it in real quick, because I knew there wasn't going to be a play at the plate or anything. It was just, 'Catch it.' I knew that if I would have hit the wall, I would have dropped it."
Still, the Astros took a 4-3 lead to the ninth and were one out away from closing it out.
Veras started the inning by striking out Hank Conger before walking Jimenez on a 3-2 pitch just off the plate. He was one out away from a save after J.B. Shuck flied out to left. Trout followed with a grounder that went under the glove of Matt Dominguez at third and nicked off shortstop Marwin Gonzalez's glove for a hit.
"I should have made that play on Trout," Dominguez said. "I was on the line and it's a play I could have made, but it happened to go under my glove."
That set the stage for Pujols, who stroked a 1-0 sinker into the left-field corner to send a sellout crowd of 43,520 home happy for the first time this season.
"It was a great environment, and these guys answered the bell and rose to the occasion," Porter said. "We had some big hits and our bullpen guys did a tremendous job getting big outs. It just so happened that last base hit was out of the reach of Dominguez and the base hit before that in the six-hole. Their hits found the right spot."
Harrell rebounded from a shaky outing Sunday against the A's, giving up six hits and one run in 5 2/3 innings. He was in vintage form, recording 11 of 17 outs on ground balls, five by strikeout and one on a popup, which came on the first batter of the game.
Josh Hamilton hit a solo homer off Harrell with two outs in the sixth for his first home run in an Angels uniform.
"My goal is to keep us in the game," Harrell said. "We took the two-run lead early and I tried to keep us in the lead and that's why in the situation with Hamilton, I felt like I could challenge him there. When you make a mistake to a good hitter like that, he's going to hit the ball a long way."
The Astros showed grit throughout the game, escaping several jams by getting big double plays and key strikeouts. None was bigger for Harrell than striking out Shuck to end the fifth to strand runners at second and third base.
"I started to lose my control a little bit and I could sense it," Harrell said. "For me, that was a turning point and a big inning."