Evan Carter had a solo home run and threw out a runner at home for the Rangers (79-64) in the opener of a four-game series.
Texas right-hander Dane Dunning (10-6) allowed three runs and six hits in six-plus innings. The Rangers had gone 22 games without a win from a starting pitcher.
Cavan Biggio hit a solo home run for Toronto (80-64).
Toronto right-hander Chris Bassitt (14-8) allowed five runs and nine hits in 5 1/3 innings.
Texas took a 1-0 lead in the second. Mitch Garver walked, took second on Robbie Grossman's single and advanced to third on a fielder's choice grounder by Leody Taveras. Garver scored when Bassitt left the mound and moved toward him as he strayed from the bag. Bassitt had already used his two disengagements.
Toronto took a 2-1 lead in the home second. Davis Schneider singled. Biggio walked and Alejandro Kirk hit an RBI single. Kevin Kiermaier walked and George Springer hit an RBI single.
Carter opened the third with his first career major league home run, a blast to right.
Texas scored once in the fifth. Josh Smith walked and took third on Carter's single. Smith was caught off third to start a double play on Marcus Semien's grounder to third. Corey Seager hit an RBI single.
Kiermaier led off the home fifth with a double and was thrown out at home by Carter on Springer's single to left.
Texas took a 5-2 lead in the sixth. One-out singles by Grossman and Taveras put runners at the corners. Grossman scored on a wild pitch and Heim hit an RBI double.
Toronto pinch hitter Spencer Horwitz singled in the sixth, took third on a wild pitch and a fly out and scored on Biggio's sacrifice fly.
Chad Green walked Semien to open the seventh before being replaced by Genesis Cabrera, who allowed a double to Seager. Garver was walked intentionally to load the bases. Grossman hit a sacrifice fly to score Semien. Taveras walked to load the bases and Heim hit his 16th homer of the season, a 405-foot blast to left center.
Biggio hit his ninth homer of the season against Ian Kennedy in the ninth.
—Field Level Media