Bradford Bulls edged past Wakefield Trinity Wildcats 26-24 in the West Yorkshire derby encounter at the Belle Vue stadium.
Wakefield dominated the first half, with Frankie Moriano coming closest to crossing the line but the visitors' defence held firm.
Reece Lyne did open the scoring for the hosts in the 23rd minute and Peter Fox soon extended their lead.
However, two Keith Lulia tries on the stroke of half time ensured that the away side went into the second half with the momentum.
Wakefield extended their advantage once again when Mariano raced away, and the crowd thought that they had scored another try on the hour mark, only for the referee rule it out.
Two tries within 10 minutes from Tom Olbison and Brett Kearney saw the home crowd silenced as Bradford took the lead for the first time in the match.
Jamie Foster went over in the corner to see his side take an unassailable lead with less than 15 minutes remaining.
Lee Smith scored a last-minute Wakefield try which he converted himself to put his side within two points of the visitors, but it proved to be too late for a dramatic comeback.