Daniel Murphy doubled twice, scored a run and knocked in another for the Mets, who improved to 3-5 on a nine-game homestand that ends Wednesday afternoon.
A day after Jose Valverde blew a save and was given his release, New York used Jenrry Mejia for two innings to close out the win.
Edinson Volquez walked five and allowed two runs on four hits in five laborious innings, but the Pirates took him off the hook when Starling Marte hit a bases-loaded, two-run single in the sixth to even things at 2-2.
The hit ended Jonathon Niese's outing, and Vic Black (1-0) got out of the inning by striking out pinch-hitter Ike Davis to leave the bags full.
The Mets got the two runs right back off reliever Jeanmar Gomez (0-2), who retired two in a row after walking Ruben Tejada to open the home sixth. Two wild pitches advanced Tejada to third, and Lagares took a payoff pitch into left to break the tie.
Murphy slapped Gomez's next pitch into the right-field corner, and Lagares raced all the way around from first for an insurance run.
Black, the player-to-be-named-later on a deal that sent Marlon Byrd to the Pirates at last year's trade deadline, struck out Gaby Sanchez to leave runners on the corners in the seventh, and Mejia got out of a jam in the eighth by getting pinch-hitter Pedro Alvarez to hit into a double play.
Mejia put two on in the ninth but got Sanchez to ground into a fielder's choice to earn his fourth save.
The Mets were playing for the first time with their new hitting coach and went 3-for-16 with runners in scoring position and left 10 on base.
Still, they jumped ahead early.
Bobby Abreu singled through the shift and into right field to bring in Murphy with the game's first run in the third frame, and Lagares, who made a spectacular catch to rob Andrew McCutchen of an extra-base hit in the first inning, doubled off the wall in left to plate Tejada in the fourth.
McCutchen answered Lagares' thievery in the third with a sensational, outstretched diving stab in right-center on a ball hit by his fellow center fielder.
Celebrity Couples of 2014 [PHOTOS]