Hours after the Mets traded away two of their best hitters, the team found a way to make up for some of the offensive loss.

They found the answer Tuesday night in the bat of Jon Niese, who incidentally used his left arm to help to ease some of the massive pain suffered through Matt Harvey’s right elbow injury and possible looming surgery.

Nothing can remove the devastating sting of losing Harvey to a partially torn ulnar collateral ligament. But the starting pitching performances the Mets received the last two nights can make the hurt just a little more tolerable.

One night after Zack Wheeler worked impressively into the seventh inning, it was Niese’s turn. And he was even more impressive there than he was at the plate where he had a three-run double and scored a run. Niese pitched the third complete game of his career, first since 2010, to thwart the Phillies on just three hits and the Mets stopped a five-game losing streak with a 5-0 victory at Citi Field.

Niese (6-6) delivered the game’s biggest blow — a bases-loaded, full count double to left center that capped a sixth inning outburst of four unearned runs. In winning his third straight decision, all since returning from a partially torn rotator cuff injury, Niese struck out five and walked one in his second career shutout. The first was June 10, 2010.

With a supporting cast that no longer included the Mets’ two leading run producers, Marlon Byrd (71 RBIs) and John Buck (60), both dealt earlier today to the Pirates, Niese helped choreograph the offense. Before his bases-clearing double, Niese helped build the Mets’ first run. He knew its value: the Mets gave him a total of 14 runs in his previous home starts.

Niese drew a one-out walk in the third and moved up when Eric Young Jr. tried to bunt his way on but took a sacrifice. Then Daniel Murphy singled to right. Niese appeared to receive a stop sign from Tim Teufel at third. But with runs so hard to come by the lefty pitcher just kept coming and was no-doubt-about-it safe as the throw from Philadelphia’s John Mayberry Jr. was up the third base line.

The Mets made it 5-0 against Phillies starter Kyle Kendrick (10-11) in the sixth, aided immensely by a Phillies error. And Niese’s bat.

Andrew Brown singled before Ike Davis hit a roller down first. First baseman Kevin Frandsen tried for the force at second — and threw into center field, to set up a second and third, no out situation. Wilmer Flores bounced out with the infield in. Juan Lagares was intentionally walked but rookie catcher Travis d’Arnaud spoiled the strategy with a sac fly to center. The runners advanced so the Phillies intentionally walked Omar Quintanilla to get to Niese.

Niese ripped the eighth pitch of the at-bat into the left-center gap for a career high three RBI in a game and a 5-0 advantage.

Niese was in control all game. He yielded singles in the first and second innings, the latter being flipped in a double play. That started a run of 17 straight retired batters, a string broken in the eighth by Michael Young with a leadoff double.