After the game, Nationals manager Matt Williams said Stephen Strasburg would make the opening-day start at the New York Mets on March 31.
Cosart struck out nine, including six in a row and seven of eight. The right-hander had come into the game with a 7.17 ERA through his previous three starts.
''That's the best I've seen him as far as the sharpness of his off-speed stuff,'' Astros catcher Jason Castro said. ''That's the best I've ever seen his breaking ball. He's been working a lot on that. It's come a long way even since the beginning of spring. . It's really good to see. It was a fun game to catch for sure.''
After going through the Nationals lineup the first time, Cosart started Washington's top three hitters - Denard Span, Ian Desmond and Ryan Zimmerman - with a breaking ball the time through the order.
Cosart said he has been told one of the biggest adjustments he needs to make to stay in the big leagues is to be able to throw his breaking ball for a strike in any count.
''I threw it 0-0. I threw it 0-1, I threw it 2-1(and) 2-0,'' Cosart said, ''just to be able to have the hitters have something else in their mind. It paid dividends today.''
Anthony Rendon became Washington's first base runner when he singled off Houston's Raul Valdes with one out in the sixth.
Washington starter Taylor Jordan, who is competing for the team's fifth starting spot, allowed three hits and one run over five innings. He struck out three.
The right-hander was more aggressive than in his previous start and worked on his fastball command.
''My control wasn't like I had wanted it, but I had some good movement on my sinker today and my changeup was working here and there,'' Jordan said.
The Nationals were held to just five hits. Jesus Guzman hit a solo home run for the Astros.
Nationals: Jordan is competing with Tanner Roark and Chris Young for Washington's final starting spot, but said he is trying not to think about it.
Astros: With his off-speed pitches working so well, Cosart was able to freeze a number of Nationals hitters with an inside fastball. Four of his nine strikeouts came on called third strikes.
Nationals: Fister will throw three innings (or 45 pitches) against the Miami Marlins on Saturday in Viera. It will be the right-hander's first appearance in a big league game since his Nationals debut on March 2. He was then diagnosed with inflammation in his elbow. ... Ross Ohlendorf, who had been out with back spasms, threw a scoreless inning of relief.
Astros: Right-hander Mark Appel, the No. 1 pick in last year's draft, will make his spring debut Friday. Astros manager Bo Porter said it had not been determined if Appel will throw in a minor league game or if he will face the Miami Marlins. Appel had an appendectomy in January. ... Shortstop prospect Carlos Correa was hit on the hand by a pitch and will have X-rays taken.
TO THE BULLPEN
Nationals LHP Ross Detwiler was not happy about being sent to the bullpen, but in his first meeting with reporters since the news broke Monday, he did his best to put a good face on it.
''I still view myself as a starter, but I'm not going to go out there and hope somebody does bad or somebody gets hurt,'' he said. ''We're in it to win and I think it's going to hurt worse if we don't win the whole thing this year.''