Liverpool returned to the top of the Premier League but were made to work hard for victory at relegation-threatened Cardiff City.
Jurgen Klopp's side had to be patient as they dominated a dogged Cardiff side, who had chances of their own to cause an upset.
Liverpool made the breakthrough in spectacular fashion, as Georginio Wijnaldum met Trent Alexander-Arnold's low corner with a thunderous first-time effort which threatened to break the net.
The wild celebrations spoke of the visitors' relief, and they had to negotiate some nervy moments, most notably a staggering miss by Cardiff captain Sean Morrison, who miscued a header with the goal at his mercy.
Things then got worse for Morrison, who conceded a penalty after grappling with Mohamed Salah, and substitute James Milner confidently converted the spot-kick to seal victory for the visitors.
Cardiff remain in the relegation zone, three points adrift of safety.
Liverpool, meanwhile, restore their two-point lead at the top of the table over Manchester City, who play their game in hand away at Manchester United on Wednesday.