Toronto got all five of its runs in the final two innings.
After B.J. Ryan surrendered a game-tying homer to Detroit's Brandon Inge in the top of the ninth, the Jays loaded the bases off Tigers reliever Brandon Lyon in the bottom half. With one out, Barajas hit to deep center and Jose Bautista scored.
Scott Rolen started the Blue Jays' rally with a lead-off homer in the eighth, and Aaron Hill hit a three-run homer later in the inning.
Ryan (1-0) was credited with the win. David Purcey worked seven innings for Toronto and allowed three runs on five hits.