Hanni captained the side in the Belgium Super Cup match against Zulte Waregem and scored an equalising goal, as they won 2–1. Two weeks later on 6 August 2017, he scored his first league goal of the season, in a 1–0 win against Oostende. Three months later on 13 October 2017 against KV Mechelen, Hanni set up two goals, setting up the club's first two goals of the game, in a 4–2 win. Later in October, he scored the club's third goal of the game, in a 3–2 win against Eupen. Hanni made his UEFA Champions League debut, playing the whole game, in a 2–1 loss against Bayern Munich on 12 September 2017. Two months later on 22 November 2017, Hanni scored his first UEFA Champions League goal against Bayern Munich in their second meeting, as Anderlecht lost 3–1. Four days later on 26 November 2017, he scored the club's second goal of the game, in a 4–0 win against K.V. Kortrijk. Hanni later scored four more goals for the side, including a hat–trick, in a 3–3 draw against Standard Liège on 28 January 2018, in what turned out to be his last appearance for Anderlecht. In the January transfer window, he was linked with a move away from Anderlecht, with several Russian clubs interested in signing him. By the time he departed Anderlecht, Hanni went on to make thirty–one appearances and scoring ten times in all competitions. His relationship with Anderlecht supporters has been strained as the reason of his departure. Spartak Moscow On 31 January 2018, Hanni signed a three-and-a-half-year contract with Russian defending champions Spartak Moscow. Upon joining the club, he stated the move to Spartak Moscow was a decision he couldn't refuse and he was motivated to win trophies at his new club. Hanni made his Spartak Moscow debut, facing in the first leg of the UEFA Europa League's Round of 32 against Athletic Bilbao, coming on as a 75th-minute substitute, in a 2–1 loss. However, the club were eliminated from the tournament despite winning 2–1 in the second leg but lost 4–3 on aggregate. He made his league debut for the club, coming on as a 58th-minute substitute, in a 2–1 win against SKA-Khabarovsk on 11 March 2018. In a follow–up match against Rubin Kazan, Hanni scored his first FC Spartak Moscow goal, in a 2–1 win. He later scored his second goal for FC