The Athletics fell behind early but cut the lead to one with a three-run fifth. An RBI double by Matt Chapman tied it with no outs in eighth before Canha's single off Chris Devenksi (2-2) with one out made it 6-4.
Canha's hit landed in the corner of left field and the Astros challenged the ruling that the ball was fair, but the call was upheld.
It was another big eighth inning for the A's, who lead the majors with 69 runs in the inning this season. This one helped them take three out of four against the Astros.
Nick Martini had three hits and drove in two runs for the Athletics, who are 19-5 in their last 24 games.
Yusmeiro Petit (3-2) allowed one hit in 2 1/3 scoreless innings. Ryan Buchter took over for the eighth and made back-to-back nifty plays to pitch a perfect inning.
The first one came when a comebacker by Yuli Gurriel hit him on the thigh and rolled away from the mound. He chased it down and made a barehanded throw that beat Gurriel to first. Two pitches later, Buchter mishandled a dribbler by Josh Reddick before scooping it up and flipping it to first for the out.
Lou Trivino struck out two in the ninth for his fourth save in five opportunities.
Alex Bregman drove in two with a double in the third and Tony Kemp's two-run homer made it 4-0 in the fourth.
Oakland starter Trevor Cahill went 3 2/3 innings in his first start since June 2 after spending more than a month on the disabled list with an Achilles injury. He allowed three runs on three hits and walked three.
Houston's Charlie Morton allowed six hits and three runs in 4 1/3 innings.
Khris Davis extended his career-long hitting streak to 14 games with a single to get things going in the eighth, and Matt Olson followed with a single. The double by Chapman to left field scored Davis to tie it at 4.
Cahill walked Kemp and Springer in the third, and both moved up a base on a wild pitch before scoring on the double by Bregman.
Max Stassi singled with two outs in the fourth to chase Cahill. He was replaced by Chris Hatcher, who was greeted by the two-run homer by Kemp.
Chad Pinder and Canha hit consecutive singles to start the fifth inning before Jonathan Lucroy walked to load the bases. The Athletics cut the lead to 4-2 on a double to right field by Martini.
Stephen Piscotty hit an RBI double with one out to end Morton's day.
Astros: INF Marwin Gonzalez returned after missing a game after taking a cleat to the left wrist on Tuesday night. ... SS Carlos Correa (back stiffness) will have to go on a rehabilitation assignment before he comes off the disabled list, so he will not play before the All-Star break.
Athletics: Edwin Jackson (1-0, 2.45 ERA) will start for Oakland in the opener of a three-game series against the Giants on Friday night. Jackson needs one win to reach 100 for his career.
Astros: Houston's Dallas Keuchel (6-8, 3.95) opposes Detroit's Mike Fiers (6-5, 3.65) when the Astros and Tigers open a three-game series on Friday night. Keuchel has won three straight decisions after dropping his previous three, and Fiers, who threw Houston's last no-hitter in 2015, won his last start after losing his previous two decisions.
More AP baseball: https://apnews.com/tag/MLBbaseball