It was a nervy 45 minutes for Liverpool before Georginio Wijnaldum's breakthrough paved the way for a vital home win over Middlesbrough.
Liverpool secured a Champions League return with a 3-0 final-day win over already relegated Middlesbrough to claim fourth place in the Premier League.
Jurgen Klopp's side will regain a seat at Europe's top table – albeit initially in the qualifying play-off round – after sitting out the competition this season, Sunday's ultimately convincing triumph ensuring Arsenal's result against Everton proved immaterial in the race for a top-four spot.
The Reds' only two home league losses this term came against lowly Swansea City and Crystal Palace, but despite Boro frustrating them for most of the first half, the north-east side succumbed to Georginio Wijnaldum's thunderbolt on the brink of half-time.
Philippe Coutinho curled home a superb set-piece strike early in the second half to give Liverpool breathing space that was increased by Adam Lallana against a visiting side who are now winless in 22 top-flight trips to Anfield.
With an instant return to the Championship already assured, Steve Agnew's men offered little in response to Liverpool's onslaught as their dismal campaign concluded with a league-low five wins to their name.
Knowing victory would guarantee only their second top-four finish in eight seasons, Liverpool – winless in their previous three home league games – started brightly and the returning Roberto Firmino tested Brad Guzan's handling with an early drive.
Calum Chambers had to be alert to clear Coutinho's cross with Daniel Sturridge lurking, as the England striker made his first start at Anfield since September.
Nathaniel Clyne blasted wide from 12 yards and news filtered through soon after that the Gunners were ahead, putting Liverpool down to fifth and adding to the tension among the expectant crowd.
Still Klopp's side continued to press, with Emre Can shooting narrowly over the target from 20 yards, but Boro had strong shouts for a penalty waved away in the 21st minute when Patrick Bamford took a tumble under pressure from Dejan Lovren.
Despite dominating possession, the home side had failed to truly threaten Guzan – making his last Boro appearance before departing for Atlanta United – until Wijnaldum made the breakthrough a minute into first-half stoppage time.
Clyne picked out Firmino who in turn expertly laid the ball into the Dutchman's path and he composed himself before blasting beyond Guzan at his near post, sparking wild celebrations from Klopp that were mirrored in the stands.
Liverpool secured a two-goal cushion just six minutes into the second half, Coutinho firing in his 13th Premier League goal of the season with a fine 20-yard free-kick.
And from there it was a stroll for the Merseysiders, who capped a swift counter-attack with Lallana's close-range finish to dismiss any notion of a last-day collapse.
The sense that Liverpool's work was done became evident in the lack of urgency that characterised the final 20 minutes, the most notable moment of that spell being the substitution of Sturridge for what could yet prove his final Reds outing.
Whatever his future holds, a Champions League campaign will provide fresh challenges for Klopp, whose team finished 17 points adrift of champions Chelsea, despite adding 16 to the tally they managed last season.