Danny Espinosa homered and Jordan Zimmermann tossed five innings for the Nationals.
Cook allowed only two hits, including Espinosa's leadoff shot in the fourth. He struck out two, walked one and finished the spring with a 1.88 ERA.
Boston signed the veteran right-hander to a minor league contract in the offseason to provide pitching depth and another option at the back of the rotation.
Franklin Morales worked a perfect ninth for the save.
Zimmermann went five innings, allowing six hits and three runs — two earned. Tyler Clippard and Brad Lidge each worked a scoreless inning out of the Nationals bullpen.
The teams play another exhibition game against each other Tuesday in Washington.