But it was Leeds who were in front after 13 minutes. Kalvin Phillips drove into the area and fired a low ball across the face of goal to Roofe, who fired into the roof of the net from six yards.

Preston striker Maguire had a couple of chances to draw his side level from corners, heading over at the far post before glancing a header wide from Billy Bodin’s whipped delivery.

Leeds were denied a second on 38 minutes by Declan Rudd as the Preston keeper kept out Caleb Ekuban’s fierce strike at his near post.

Just four minutes after the break, Preston were level from the penalty spot. Wales winger Billy Bodin burst into the area and was brought down by Vurnon Anita. Gallagher stepped up and slotted the equaliser into the bottom corner.

And Preston seized on their momentum to go in front just three minutes later. Gallagher’s delivery from the right picked out Maguire, who beat keeper Bailey Peacock-Farrell to the ball and nodded in from eight yards.

Alex Neil’s side were dominating and went in pursuit of a third as left-back Greg Cunningham struck from the edge of the area, but Peacock-Farrell pushed the effort away.

Leeds, who have now won just two of their last 18 league matches, threatened with a swift counter-attack after 77 minutes, working the ball to Pablo Hernandez down the left, but his strike was easily pushed away by Rudd.

The Preston keeper was more seriously tested a minute later by a fierce 25-yard strike from Ronaldo Vieira, but he palmed the effort away from danger.

The Lilywhites sealed the win eight minutes from time through midfielder Browne, who did brilliantly to head Callum Robinson’s cross into the far corner at the near post.