With the Iron already assured of safety and Rovers unable to make the play-offs, there was little more than pride to play for on a glorious afternoon in South Yorkshire.
But neither side was in the mood to ease up as they served up a thrilling spectacle, with the hosts eventually coming out on top.
Gary Hooper fired Scunthorpe ahead early on, but loanees Jay Emmanuel-Thomas and Jordon Mutch responded to put Rovers in front at the break.
The visitors got back on level terms after the interval through Paul Hayes, only for James Hayter to quickly restore Doncaster's advantage.
Substitute Jonathan Forte hit the bar for Scunthorpe before Hooper levelled in the 84th minute with his 19th league goal of the season.
But there was still time for Martis to snatch the winner as he rose to convert a corner from Dean Shiels.
Sam Hird and James Coppinger started for Sean O'Driscoll's side in place of the injured James Chambers and Paul Heffernan, while Brian Stock earned a late promotion from the bench after John Oster picked up a knee injury in the warm-up.
Kenny Milne replaced Niall Canavan in the only change to the Scunthorpe side.
Rovers were the first to threaten in a predictably open encounter.
Mutch found Coppinger on the edge of the area and his curling shot clipped the outside of the post with Iron goalkeeper Joe Murphy well beaten.
Martyn Woolford drilled narrowly wide at the other end moments later following a neat lay-off from Hooper.
Murphy then made a stunning reflex save to keep out Mark Wilson's deflected effort before Scunthorpe took the lead in the 19th minute.
Hayes' through ball put Hooper clear through on goal and the forward calmly slotted past Neil Sullivan amid appeals for offside from the home faithful.
The goal spurred Rovers into action and they equalised three minutes later when Emmanuel-Thomas controlled a long crossfield ball on his chest before beating Murphy with a delightful lob.
Doncaster dominated the remainder of the half and saw appeals for a penalty rejected in the 29th minute when Milne slipped in the area and appeared to handle while on the ground.
The visitors retained an attacking threat of their own and Hird was forced into a fine clearance to deny Hooper.
But Rovers were soon back on the front foot and were rewarded for their pressure in the 45th minute as the impressive Mutch calmly side-footed home from Gareth Roberts' deep left-wing cross.
Scunthorpe were gifted an equaliser eight minutes into the second half as Martis inexplicably missed his kick, leaving Hayes free to fire home on his 250th league start.
But Rovers regained their advantage five minutes later when Hayter latched on to an Emmanuel-Thomas pass and prodded past Murphy to make it 3-2.
Stock saw a 20-yarder deflect inches wide on the hour mark as Rovers looked to put the game to bed.
A momentary lull in proceedings followed before the game sprung into life in the final 10 minutes.
Substitute Heffernan spurned a glorious opportunity for Doncaster before Forte brought a fabulous one-handed save from Sullivan.
Forte then saw a thunderous long-range effort cannon off the crossbar, but Scunthorpe were level within seconds as Hooper turned home his second of the game from inside the area.
Hooper had a chance to complete his hat-trick moments later but failed to test Sullivan.
And Scunthorpe were punished as Martis popped up with Doncaster's winner in the 89th minute.
Shiels almost added a fifth when his curling shot struck the woodwork, but it mattered little as the hosts played out the remaining stoppage time with ease.