Rangers manager Steven Gerrard hailed a near-perfect performance after his side netted four goals in Denmark to take a major step towards the Europa League play-offs.
Goals from Alfredo Morelos, Joe Aribo and Niko Katic had Gers three ahead before the hour mark before Midtjylland netted two goals in quick succession.
However, the visitors quickly settled and Scott Arfield calmly slotted home with 20 minutes left to ensure Gerrard's side take a 4-2 lead back to Ibrox for next week's return meeting.
Gerrard told Rangers TV: "We were very close to a perfect performance. Obviously we have conceded a couple of goals but the idea was to be in a mid block and be aggressive and play as a team and be difficult to play against.
"We stood up to the physical presence and some of the goals we scored were fantastic. So I have nothing but praise for my players.
"This is a difficult opposition, they have good players, very big in profile, you can see their set-piece threat, and they have technicians that can hurt you.
"We did have a bit of a wobble but we have come away from home, scored four goals, had some outstanding individual performances.
"I thought Jon Flanagan for his first start (of the season) was immense. The two centre-backs were fantastic again and Joe Aribo again gets an unbelievable goal.
"Scott Arfield got a lovely little pass finish and if anyone was doubting Big Buff's (Morelos) commitment to this club, just watch that back for 90 minutes as I thought he was outstanding."
Gerrard hailed his side's mental strength after conceding the two goals.
"We never panicked at 3-2," he said. "We knew we were still in front and we showed great composure to go and get another one and that could be a very important goal."
Rangers' potential play-off opponents, Legia Warsaw and Atromitos, played out a goalless draw in Poland.