The victory was the biggest of the Spaniard's career and only her third tournament title as she wowed the packed stands at the Foro Italico in a 2hr 20min thriller.
Her only two previous wins in Bogota and Bastaad, both last year, were at tournaments that are never attended by top players.
But this victory was remarkable for a doubles specialist who at 27 has suddenly started to play the best tennis of her career.
Jankovic, the overwhelming favourite against the world number 26, seemed frustrated throughout as Martinez-Sanchez confused her with a range of slices, spins, drop-shots and serve-volleying.
And the Serbian, a two-time winner here, said on court after the match: "I want to congratulate Maria, she played a great match and she really killed me with all those drop shots.
"It was pretty tough. She plays very differently to most girls, hitting a lot of drop shots, she serve-volleys and she's left-handed. It's a little bit tricky."
Jankovic had earlier become only the seventh person to beat both Williams sisters in the same tournament, something she is proud of.
"To beat them takes a lot of energy out of you. They're the best athletes and the best players and to beat them is huge.
"Not many players have done that and I'm one of the few with a positive record against them which is very good for me.
"But the final is a good result here and I have to keep my head up high. I wanted to win my third title here but it's still a good result."
Martinez-Sanchez had beaten world number two Caroline Wozniacki in the third round and last year had taken a then-world number one Dinara Safina to three sets before wilting in the decider.
But it was her constant drop shots, mostly successful, that was the basis for this win.
She broke Jankovic in the fourth game of the first set from a drop shot and then served for the set at 5-3.
However, Jankovic had two break points which the Spaniard saved with a serve out wide and volley into the open court and then the second after a lightning exchange at the net.
She was still broken, though, after a woeful backhand smash went wide followed by a netted backhand drive.
She was broken again at 5-5 after another dreadful missed smash, this time on the forehand side, and then netting another easy backhand.
However she broke straight back to set up the tie-break and went up a mini-break with a foray to the net and volley winner before securing the set with a serve and volley winner on a replayed point, which did nothing to improve Jankovic's mood.
Martinez-Sanchez hit a winning pass following a drop shot to earn break point in the opening game of the second set and then nailed that with a backhand winner.
She was broken back but broke again to love at 3-3 in a game in which she incredibly hit a sliced forehand winner.
But a double fault at 15-40 when serving for the match saw her broken back for 5-5, only to then break in the next game in which she hit three drop shot winners.
And she rounded off an incredible victory with a serve and volley winner.
Despite her victory she would have no time to rest as she also had to play in the doubles final with compatriot Nuria Llagostera-Vives against Italian Flavia Pennetta and Gisele Dulko of Argentina.