Both were tossed by home-plate umpire Angel Campos. It was Hurdle's first ejection of the season and his sixth as Pittsburgh's manager.
Hurdle was ejected five times last season. His last ejection was Sept. 13 in the fifth inning of a 6-4 loss to St. Louis by Sam Holbrook.
Barajas appeared to disagree with Campos over a call on a pitch to Carlos Beltran. Barajas threw his mask into the air after the ejection. Hurdle came out and was also tossed. Barajas disagreed with several other ball-strike calls earlier in the inning.
Michael McKenry replaced Barajas behind the plate.
St. Louis scored four times in the first and added three runs in the second for a 7-0 lead.
Steve Overbey is a contributor to MLB.com. This story was not subject to the approval of Major League Baseball or its clubs.