Jason Vargas of the Mets pitches in the first inning...

Jason Vargas of the Mets pitches in the first inning against the Marlins at Citi Field on Monday. Credit: Jim McIsaac

Jason Vargas, who had been perfectly awful this season, was perfect for the first three innings and finished with five shutout innings as the Mets beat the Marlins, 2-0, on Monday night at Citi Field.

Vargas (1-3), who lowered his ERA from 13.86 to 9.87, allowed two hits, walked one and struck out seven as the Mets won their fourth in a row.

“That was much more Vargas-like,” manager Mickey Callaway said. “That’s what I remember.”

Asrdubal Cabrera and Wilmer Flores drove in the Mets’ runs. Five Mets relievers threw four shutout innings, with Jeurys Familia working around a one-out double in the ninth for his 13th save.

In their last four games — all wins — Mets relievers have thrown 13 scoreless innings.

Vargas, who allowed nine runs in his three previous first innings, set down the major leagues’ lowest-scoring team 1-2-3 in the first. He struck out the first two batters in the second and two more in the third as he retired the first nine Miami batters with ease.

“I think he had his better command,” Callaway said. “He still fell behind at times, but he had good enough command to come back and make pitches even behind in the count and get some pop-ups and some swing and misses.”

The Mets took a 1-0 lead in the third against righthander Elieser Hernandez (0-1) when Amed Rosario singled with one out and scored on Cabrera’s two-out double into the rightfield corner. Rosario, who was running on the pitch, made it home without a throw.

Martin Prado picked up Miami’s first hit when he led off the fourth with a single to left. Vargas retired the next two batters on foul pops to first and got Brian Anderson to ground out to short to end the inning.

In the fifth, Vargas struck out Justin Bour before Cameron Maybin walked and Miguel Rojas singled. Vargas struck out Lewis Brinson and ended the inning by striking out Hernandez. Marlins manager Don Mattingly didn’t use a pinch hitter for Hernandez, who ended up going only one more inning.

The only solid pitching Vargas had done this season came in simulated games, where he was apparently untouchable. It was against real competition that Vargas proved to be shockingly hittable, with a totally earned 0-3 record in three starts.

The numbers were staggering. Vargas had allowed 26 hits (including five home runs) and 19 runs in 12 1/3 innings. This from the pitcher who tied for the American League lead in wins with 18 for Kansas City last season and who the Mets signed to a two-year, $16-million contract.

Vargas signed a few days into spring training. But his right (non-throwing) hand was broken by a line drive on March 16 and he had to have surgery. Vargas’ season couldn’t get started until he was able to put a glove on his right hand.

Vargas hadn’t pitched since May 8, when he gave up four runs in four innings in a 7-2 loss at Cincinnati. With multiple off days, the Mets let him work out his troubles on the sidelines, and it seems to have worked.

“Definitely anxious to get back out there,” Vargas said. “When you get skipped or get pushed back, it just means that you’re not doing the job, so you want to get back out there. You want to be able to get back on the horse and not prolong the thoughts that you’re already having. Fortunately for us, it worked out.”

The Mets made it 2-0 with an unearned run in the bottom of the seventh. Devin Mesoraco blooped a double to right, moved to third when Prado let Luis Guillorme reach on an error and scored on pinch hitter Flores’ single to right.