Rangers survived a scare before three goals in 13 second-half minutes helped them to a 3-1 win at home to East Stirling.