The visitors more than rode their luck in the opening exchanges, and led on the half-hour when James Wesolowski was tripped in the box. Rankine converted the penalty.
Chris Holroyd levelled within a couple of minutes, going on an inspired run and finishing calmly past Johnny Maxted.
But Rankine scored an unexpected winner for the Lions in the second half, after Will Hatfield was tripped in the box by goalkeeper Scott Flinders.
The stopper initially saved Rankine's second penalty, but the striker stayed calm to knock the rebound in.
Report supplied by the Press Association
Match ends, Macclesfield Town 1, Guiseley 2.
Second Half ends, Macclesfield Town 1, Guiseley 2.
Simon Walton (Guiseley) is shown the yellow card.
Substitution, Guiseley. Adam Boyes replaces Jake Cassidy.
Substitution, Macclesfield Town. Rhys Browne replaces Danny Whitaker.
Substitution, Guiseley. Jordan Preston replaces James Wesolowski.
Substitution, Macclesfield Town. Anthony Dudley replaces Ollie Norburn.
Substitution, Macclesfield Town. Danny Whitehead replaces Omry Perel.
Will Hatfield (Guiseley) is shown the yellow card.
Goal!  Macclesfield Town 1, Guiseley 2. Michael Rankine (Guiseley).
Second Half begins Macclesfield Town 1, Guiseley 1.
First Half ends, Macclesfield Town 1, Guiseley 1.
Goal!  Macclesfield Town 1, Guiseley 1. Chris Holroyd (Macclesfield Town).
Goal!  Macclesfield Town 0, Guiseley 1. Michael Rankine (Guiseley) converts the penalty with a.
First Half begins.
Lineups are announced and players are warming up.
Michael Rankine's double helped Guiseley to their first away win of the season with an impressive display at Macclesfield.