The capital outfit should have been home and dry after a dominant first half against the 10-man visitors, but Messi's free kick saw Madrid forced to grind out a tense result.