Paul Woods struck four minutes from time to secure Queen's Park a 2-1 victory over Berwick which sends them to the Scottish League Two summit this evening.
It took until the 75th minute for Ross McPherson to put the hosts ahead at Hampden Park, and Andrew Russell quickly equalised before Woods had the last word.
The Spiders have been slowly catching out-of-form Arbroath and Albion Rovers at the top of the table, but were largely outplayed by mid-table Berwick.
Colin Cameron forced a third-minute save out of William Muir and Russell twice headed wide as the visitors had the better of a first half in which David Gold and Scott Marshall also went close.
Queen's had struggled to convert their share of possession into chances until Jordan Moore glanced just over from close range, and their steady improvement brought about McPherson's goal.
The substitute replaced Moore and soon put the hosts in front as he bundled in Shaun Fraser's corner, only for Russell to level for Berwick within two minutes as he found the bottom corner with his left foot.
Rangers nearly snatched victory themselves when Muir made a crucial stop from Russell a couple of minutes prior to Woods guiding home his ninth and perhaps most important goal of the season from an 86th-minute Fraser cross.