The eight tries were shared, but Martin landed four goals from as many attempts - including a couple from wide out - while Stefan Ratchford missed with two of his five for the visitors.
The lead changed hands six times and the game was in the balance until the final five seconds when the visitors missed a chance to win it.
But, after a poor opening 40, Leeds just about deserved their win for a much-improved second half effort and there were some good individual performances.
Warrington’s first try was a poor once to concede, Matt Dufty nipping past the cover to touch down his own kick after just two minutes at the end of the visitors’ opening set.
They were over again soon afterwards, but Josh Thewlis put a foot on the sideline before getting the ball down and video official Chris Kendall backed Ben Thaler’s ‘no try’ call.
That was a terrific defensive effort by the Leeds captain and his short pass set up Leeds’ initial touchdown, by Sam Walters, after 24 minutes.
The lead was short-lived. Dufty caught Adidan Sezer’s kick near Warrington’s line, broke past a weak attempted tackle by James Bentley and Matty Ashton was in support to score a try which Ratchford improved.
Danny Walker missed a sitter for Warrington, spilling Ratchford’s pass with the line open and Leeds were fortunate to be only four adrift at half-time.
That became six soon after the break when Ratchford kicked a penalty, but Rhinos levelled on 49 minutes through a brilliant leap by David Fusitu’a, who got above Ashton to take Sezer’s kick.
It took Warrington six minutes to go ahead for the third time, Ratchford - who couldn’t convert - crossing from George Williams’ pass. It might have been game over moments later when Williams crossed, but the touchdown was ruled out for obstruction on Bentley.
In the set from the penalty Sezer ghosted into a gap and Luke Hooley took the pass for his first Super League try, with 19 left.
Eight later, Smith burst into space and though Hooley was caught by Ashton, the ball was moved wide to Nene Macdonald, he was pulled down just short, but squeezed out an incredible offload and Bentley crossed.
Martin’s superb conversion Proved decisive as Matty Nicholson pulled a try back which Ratchford improved. Warrington almost snatched it in the final seconds, but Dufty couldn’t quite hang on to Ratchford’s kick.
Leeds Rhinos: Hooley, Fusitu’a, Martin, Macdonald, Handley, Johnson, Sezer, Walters, O’Connor, Oledzki, McDonell, Bentley, Smith. Subs Newman, Lisone, Donaldson Holroyd.
Warrington Wolves: Dufty, Thewlis, Mata’utia, Ratchford, Ashton, Williams, Drinkwater, Mikaele, Walker, Vaughan, Currie, Nicholson, Crowther. Subs Dudson, Philbin, Harrison, Clark.
Referee: Ben Thaler (Wakefield).
Here’s how the Leeds players rated.