The seven-goal thriller saw both teams put the ball in their net and when it looked like the game was heading for a stalemate, it was the Algerian who had the final say with his 59th-minute effort.
Steven Gerrard’s side began the game on a bright note after Roman Eremenko scored into his own net after five minutes but Lorenzo Melgarejo levelled matters for the hosts.
Connor Goldson cancelled out Daniel Candeias goal before Rangers took the lead again through Glenn Middleton four minutes before the halftime break.
In the second half, Hanni produced moments of brilliance to help his side record their first win of the competition.
First, he assisted Luiz Adriano to get the equaliser before his strike helped Raul Riancho’s side overpower the visitors.
With the result, the Moscow based team leaped into second place in Group G, above Rangers.
FULL TIME: Spartak come from behind at the break to hand Gers their first European defeat of the season. pic.twitter.com/8UQ82Vjy8d— Rangers Football Club (@RangersFC) November 8, 2018