Liverpool emerged triumphant from a breathless night laced with danger.
The final whistle sparked an outpouring of relief both on the field and in the dugout.
The Reds walked away from the Rhein-Neckar-Arena with a priceless lead to take back to Anfield next Wednesday night.
It proved to be another happy return to Germany for Jurgen Klopp as he inflicted Hoffenheim's first home defeat for 15 months and guided Liverpool to within touching distance of the prestige and riches of the Champions League group stage.
But for Mark Uth's late strike the Reds' position of strength in the tie would have been even greater.
However, Liverpool could have no complaints about the outcome after riding their luck throughout a frenetic contest in Sinsheim.
The night belonged to Trent Alexander-Arnold, who capped an outstanding European debut for the Reds with a stunning free-kick to open the scoring.
This was the stuff dreams are made of as the teenager from West Derby, who used to peer through the holes in the walls of Melwood to watch his heroes train, bagged the first senior goal of his career in style.
When Liverpool were in need of inspiration, Alexander-Arnold stepped up and delivered. It was reminiscent of his mentor Steven Gerrard.
Just as at Watford on Saturday, the Reds packed a punch going forward as they created a stack of opportunities, but defensively they looked just as vulnerable.
This victory will do little to appease fans concerned about a lack of squad depth both at the back and in midfield. Reinforcements are urgently required.
Nervy at Vicarage Road, Simon Mignolet was outstanding here. The Belgian keeper kept out Andrej Kramaric's early spot-kick and repeatedly saved the Reds' blushes with a succession of fine saves to thwart the hosts.
When substitute James Milner's cross was deflected in off substitute Havard Nordtveit, Liverpool's first European win on their travels since they beat Rubin Kazan in November 2015 was secure.
Uth gave the Bundesliga outfit a glimmer of hope but Klopp had got what he had come for.
This was the biggest night in Hoffenheim's history with the sold-out Rhein-Neckar Arena a cauldron of noise.
Young boss Julian Nagelsmann was bold, employing a front three of Serge Gnabry, Sandro Wagner and Kramaric and they made life uncomfortable for Liverpool early on.
Once again the Reds, who were unchanged, were painfully slow starters and some slack defending enabled the hosts to seize the initiative.
Dejan Lovren struggled but he wasn't helped by the amount of space in behind the erratic Alberto Moreno, which the Croatian found himself having to deal with as Hoffenheim targeted that area.
The impressive Joel Matip got a vital touch to deny Gnabry before Lovren unconvincingly dealt with a free-kick swung into the box.
The penalty was incredibly soft. Lovren, who had been nutmegged, stuck out a leg and Gnabry accepted the invitation to run into it.
Dutch referee Bjorn Kuipers pointed to the spot but justice was done. Kramatic's effort was weak and Mignolet dived to his left to made a comfortable save.
Liverpool belatedly settled and started to make Hoffenheim's backline look equally as flaky.
Considering the prize at stake, the game was remarkably open and Mane and Salah started to impose themselves on proceedings.
Mane had already forced a save from a tight angle when Salah burst clear from halfway.
It was a golden chance but strangely the club record signing opted to take it with his right foot and knocked it beyond Oliver Baumann and wide of the upright.
With Emre Can shining in front of Germany boss Joachim Löw as he snapped into tackles and used the ball intelligently, Liverpool improved the longer the half went on.
Alexander-Arnold had caught the eye long before he took centre stage.
The 18-year-old wasn't exactly blessed with cover on his flank with Salah operating ahead of him but he dealt with everything Hoffenheim threw at him.
Time and time again he was in the right place at the right place – sensing danger and dealing with it.
Offensively, Alexander-Arnold was always an outlet and his work-rate was underlined by the manner in which he closed down an attempted clearance. The ball cannoned goalwards off his boot and into the arms of Baumann.
His growing confidence was epitomised by the goal – surrounded by senior team-mates he took responsibility after Mane had been cynically chopped down by Ermin Bicakcic 25 yards out.
It was a moment Alexander-Arnold will never forget as he whipped an unstoppable right-footer into the bottom corner. The jubilant youngster darted off towards the corner flag in manic celebration before being mobbed by his team-mates.
Liverpool had a lead they scarcely deserved and they were indebted to their keeper as it remained in tact. Mignolet was alert to thwart Gnabry and then grateful to see Wagner fire the rebound wide.
Lovren almost atoned for his earlier errors with a header from Moreno's corner which dropped agonisingly wide.
The second half brought more of the same with the Reds deadly on the counter but creaking at the other end.
Liverpool looked destined to double their account when Mane put one on a plate for Firmino but he failed to beat Baumann from close range.
Hoffenheim cranked up the pressure and the Reds found their backs firmly against the wall.
Moreno inexplicably stood and watched as Pavel Kaderabek connected inside the box and was fortunate that the wing-back's touch let him down.
But Matip really came to the fore as he won some pivotal aerial battles.
Just as at Watford, Gini Wijnaldum was off the pace, but when Klopp opted for fresh legs it was Henderson who made way for Milner.
As Hoffenheim grew ever desperate, they left more gaps for Liverpool to exploit.
Salah and Lovren went close before the Reds finally made Nagelsmann's side pay 16 minutes from time.
Firmino cleverly picked out the run of Milner down the left. The vice-captain's cross was aimed towards Salah but it struck Nordtveit and looped inside the far post.
“Bring on yer Internazionale,” roared the 2,300-strong travelling Kop.
Some may have crumbled at that stage but Hoffenheim dug deep and finished with a flourish.
Mignolet beat away Nadiem Amiri's effort but was finally beaten when Uth drilled home.
It was the least Hoffenheim deserved and Kopites' hearts were in mouths when Benjamin Hubner nodded over at the death.
Advantage Liverpool. But this tie isn't over. The room for improvement remains vast.
MAN OF THE MATCH. Trent Alexander-Arnold. Solid defensively on his European debut and celebrated the first senior goal of his career in style.
Source: Liverpool Echo
This story has been reproduced from today's media. It does not necessarily represent the position of Liverpool Football Club.