The Athletics have gone 16-3 since May 17 to move from seven games behind to within a half game of Texas for the lead in the American League West.
Chicago owned a 3-0 lead through three innings, but Oakland nibbled away with a series of one-run innings fueled mostly by home runs.
Yoenis Cespedes hit one in the fourth and another in the sixth, after which Josh Reddick connected on a solo shot in the seventh that tied the game at 4-4.
The home run in the 10th from Rosales came off Matt Thornton (0-2).
Jerry Blevins (5-0) worked the ninth for the Athletics and survived a leadoff single to get the win. Grant Balfour also gave up a leadoff base hit in the 10th, but eventually stranded the tying run on third base for his 14th save.
Jordana Brewster on Paul Walker: 'He was an enormous presence in my life'
Couple mistakenly served bag of cash at McDonald's drive-thru