Gurriel hit .319 and became Houston's second player to win a batting title after Jose Altuve in 2014, '16 and '17. Gurriel became the second Cuban-born big league batting champion after Tony Oliva in 1964, '65 and 1971.
"It's something really important," Gurriel said through a translator. "I think everybody knows it's a big deal, and it's tough to win a batting title, so that means a lot. I was fine either way with playing today. ... It turned out that I was able to be there in the end, so it all worked out."
Gurriel, who entered in the ninth as a defensive replacement, singled to left off Lou Trivino (7-8) to score Jason Castro, who had singled starting the inning and took third on Yordan Álvarez's one-out double.
Gurriel said he wasn't prepared to hit on Sunday and hadn't taken a swing all day before the at bat, but he had a positive mindset to get a hit.
"He didn't sit on it," said Houston manager Dusty Baker, who claimed he predicted to bench coach Joe Espada the previous inning that "Yuli is going to win this game. Walkoff."
Astros teammate Michael Brantley went 0 for 2 and finished at .311.
Houston went 95-67 and opens the Division Series at home Thursday against the Central champion Chicago White Sox.
Oakland was 86-76, finishing nine games back of the Astros in third place.
Seth Brown's two-run homer off Zack Greinke -- his second homer of the game -- and Khris Davis' solo homer off Blake Taylor (4-4) tied the score in a three-run ninth.
"To come up in a situation like that, hit a homer as we have seen him do so many times here after a tough battle and road back to the big leagues, to be able to finish it off like that, it warmed everybody's heart," Oakland manager Bob Melvin said of Davis.
"We didn't finish off the game like we wanted, but to have the fight in the ninth inning to come back and tie the game like that, especially with Khris' homer at the end, it was a really good feeling. Unfortunately, we came up short at the end."
Kyle Tucker gave the Astros a 4-3 lead with a two-run homer to right in the sixth, his 30th home run this season.
Chas McCormick, Jake Meyers and Carlos Correa added solo home runs. Altuve had an RBI double in the seventh.
José Urquidy yielded three runs on four hits in six innings. Urquidy allowed three runs or fewer in nine of his last 10 starts.
Greinke, active from the 10-day injured list prior to the game, allowed two runs in 2 1/3 innings of relief, leaving to a standing ovation.
Brown had his first career multi-homer game, hitting a solo home run in the second. Tony Kemp hit a solo shot to left in the third and a sacrifice fly in the fifth.
Cole Irvin allowed four runs and five hits in six innings.
Correa, eligible for free agency, ran out on the field to take his position on the field at shortstop, but the rest of the team stopped before joining him. When Correa got to his position, he looked back to the dugout as the rest of the team and fans gave him an ovation. Correa responded by patting his chest and pointing to the team and crowd.
Correa was removed to start the ninth inning, hugging his teammates as he exited the field and tipping his cap to the crowd as he left.
"Ninth inning, what they did right there was truly special letting me walk off the field," Correa said. "I'm not a crier, but I definitely felt like crying. Very emotional. I want to thank all my teammates and the coaching staff for making that happen because it truly was special to me."
Athletics: INF Jed Lowrie, who was placed on the injured list on Sept. 26 with a sprained right wrist, is in a splint for four weeks, Melvin said. "I think there's a hairline fracture, so he will be in a splint for four weeks," Melvin said.
Athletics: Open at home against the Los Angeles Angels on March 31.
Astros: Baker said RHP Lance McCullers, Jr. will probably get the Game 1 start.
Astros walk it off on final game of season
Yuli Gurriel singles in the ninth inning to win it for Houston.