Two goals late on, including a penalty, helped Rangers' goal difference after the hosts missed a series of chances in the first half.
That set the tone for the first half as the hosts missed a series of chances.
New signing Jon Daly was the main culprit, firing just wide before missing two excellent chances with his head after good work from Law.
With five minutes to go until the break, Rangers found the second goal and it came from their star performer, Law. Daly challenged well in the air and the midfielder picked up the pieces, rounding the defender before passing the ball into the corner.
Brechin brought on Andy Jackson at half time, and the substitute made the desired impact, scoring an excellent overhead kick midway through the second period.
Black stepped up, but missed his penalty, only to react quickest and tuck the rebound home.
They were not finished there, as Rangers scored their fourth thanks to substitute Dean Shiels's curling effort from the edge of the box five minutes later.