Through all the rotation issues and injuries the Mets have battled this season, Bartolo Colon has been a rock.

But on Thursday night, the rock got rocked.

Colon gave up three home runs in the fourth inning and wound up allowing six runs and 10 hits in 4 2⁄3 innings in the Mets’ 9-7 victory over the Nationals at Citi Field.

“I was missing my spots today,” Colon said through a translator. “In a big game like today, you can’t be missing spots.”

Asked if he feels more pressure with Matt Harvey on the disabled list, Colon added, “All we have to do is to continue to do our jobs.”

advertisement | advertise on newsday

With the score tied at 1-1 in the fourth, Bryce Harper homered on a 2-and-2 fastball from Colon, 43. An out away from escaping the inning, he allowed back-to-back homers by Clint Robinson and Anthony Rendon that gave the Nationals a 4-1 lead.

Even after the Mets tied it in the fourth, Colon allowed two more runs in the fifth, including a two-out RBI single by Wilson Ramos. But Wilmer Flores’ three-run homer in the bottom of the fifth got him off the hook.

Colon had gone 4-1 with a 1.96 ERA and 1.09 WHIP in his previous eight appearances and had allowed only four home runs in 46 innings in that span.

Mets manager Terry Collins praised that consistency before the game, especially in the wake of injuries to Harvey, Noah Syndergaard and Steven Matz.

“We’ve said it all along,” Collins said. “He’s a guy who we were going to have stabilize the rotation coming out of spring training while we waited for Zack [Wheeler] and he’s been the guy that’s sound through the whole thing, a guy who goes out with no complaints every five days.

Mets videos

“We’re very lucky to have him. We’re lucky we made the decision to bring him back because I’m not sure where we’d be if he wasn’t here.”

Other teams have taken notice, too.

Nationals manager Dusty Baker said before the game, “Whoever Bartolo Colon pitches against, as far as anybody I know in baseball, he has an advantage in experience and age.”

With David Lennon