Aston Villa were twice pegged back by winless RB Leipzig but scored late to all but clinch a place in the Champions League knockout stages.
Ross Barkley's deflected strike secured victory late on after Lois Openda and Christoph Baumgartner cancelled out goals from John McGinn and Jhon Duran respectively.
It took just three minutes for the Premier League side to take the lead when Ollie Watkins nodded down Matty Cash's cross to leave McGinn with the simple task of smashing home from close range.
Watkins could have easily added a second soon after but he could not get a touch on Lucas Digne's low ball across the face of goal.
Villa looked to be in total control when Emiliano Martinez mis-judged a long punt forward, allowing Openda to nip in and slide the ball into the empty net.
Watkins had the ball in the net just before the break, but the offside flag denied him what would have been just his second goal scored from open play in 11 games.
The England striker was replaced by Jhon Duran at half-time and it was the Colombian who restored Villa's lead with a stunning strike from 25 yards.
Moments after Duran was denied a second goal by another offside flag, Leipzig drew level for a second time when Baumgartner met Openda's cross with a cushioned volley into the top corner of Martinez's goal.
Openda should have given Leipzig a late lead but he stroked Pau Torres' wayward pass straight at Martinez.
Just as a draw looked inevitable Barkley's strike took a huge deflection off Lukas Klostermann, wrong-footing Peter Gulacsi and snatching the three points.
Victory leaves Unai Emery's side third in the standings with 13 points after six games and in a strong position to finish in the top eight and qualify directly for the last 16.
Villa will travel to Monaco on 21 January before wrapping up their league phase campaign at Villa Park against Celtic on 29 January.
- Published1 day ago
'Don't leave me out again!'
Duran started and scored the only goal in Villa's Premier League defeat of Southampton on Saturday, but in Leipzig he once again played a key role from the bench.
The Colombian striker replaced Watkins at half-time and scored from the bench for the sixth time this season.
Watkins played well in the first 45 minutes, setting up McGinn's opener and spurning a great chance to score just before the break.
However, the England international has scored just once from open play in his past 11 games. Should he still be starting ahead of Duran?
"I know he is only young but you have every right to go and ask the manager why you are not starting if you are doing what he wants," former England striker Alan Shearer said on Amazon Prime.
"His message will be: Don't leave me out again."
Next up for Villa is a trip to Nottingham Forest in the Premier League on Saturday.
Player of the match
After the opportunity to rate players has closed, the score displayed represents the average from all the submissions by BBC Sport users.