A goal in the 79th minute from youngster Aleksandar Trajkovski meant the home side leapfrogged their opponents in the lower reaches of World Cup qualifying round Group A.
But Chris Coleman's side more than held their own for large parts of the game that was played on a poor pitch and in an intimidating atmosphere in Skopje.
However the defeat caps a bad few days for Coleman, who also elected not to utilise new Real Madrid signing Bale from the bench even when his side desperately needed a goal during the dying minutes, instead opting for Sam Vokes.
Wales started well on a poor playing surface with Craig Bellamy and Jonathan Williams both looking lively.
But the opening exchanges were not without their scares for the Dragons as Williams survived an appeal for handball, before striker Jovan Kostovski just failed to get on the end of Daniel Georgievski's ball across the six-yard box.
Wales did, however, look the more likely to find an opening goal, but were guilty of not making the most of some good opportunities.
Williams was denied by the advancing Macedonia keeper Tome Pachovski after being released by Joe Ledley, while Bellamy's attempted pull-back to Ramsey was just cut out by a Macedonian foot.
Instead of leading, Wales found themselves behind in the 21st minute. David Vaughan was booked for a foul on Goran Pandev, and when Agim Ibrimi's free-kick cannoned off the Wales wall it fell for Trickovski.
Wales were stunned having looked the more comfortable of the two teams, and they were lucky not to fall further behind five minutes later.
Chris Gunter slipped as Pandev raced into the area and Boaz Myhill was forced to beat away the Napoli forward's drive.
Wales then went within inches of levelling through Bellamy, the Cardiff forward's excellent free-kick had Pachovski beaten, but came back off the post.
But the visitors did equalise seven minutes before the break as Ramsey's lovely turn saw him evade Trickovski who brought him down in the area. The Arsenal midfielder was not ruffled and calmly slotted home.
But Ramsey was involved in an unsavoury incident just before the break as he took a forearm in the throat from Vanche Shikov, and then hit out at Pandev as the Macedonian tried to pull him to his feet.
In the stand-off involving Ramsey, Ashley Williams picked up a yellow card which will rule him out of Tuesday's game with Serbia.
But it did not knock Wales out of their stride duirng a solid start to the second half and Jack Collison had the chance to put them ahead, only to poke wide after more excellent work from Ramsey.
The visitors were now firmly on top, but Macedonia served a reminder of their capabilities when nice work from Georgievski teed up Pandev, but the striker screwed wide with three Welsh defenders closing in on him.
As Wales pushed forward in search of a winner, so they left space for Macedonia to counter, and they were almost punished when a fine break put Trickovski in, but Myhill came out to smother after a poor touch from the forward.
But they were punished with 10 minutes to go, when substitute Trajkovski was given far too much time to advance and pick his spot beyond Myhill from the edge of the area.