The outcome was the fourth win in a row for the Mets and the 18th loss in the last 23 games for the Pirates.
Davis had a two-run homer and a three-run blast in consecutive innings in support of Jenrry Mejia (1-1), who threw five scoreless innings in his second Major League start. Mejia picked up his first career win after allowing four hits and striking out four.
The Mets scored two runs in the fourth and four in the fifth to take a 6-0 lead. Pittsburgh chipped away with single runs in the final two innings but six New York relievers prevented any further damage.