Bruno Fernandes was the last-gasp hero as Manchester United beat spirited Rangers to all but secure automatic qualification for the Europa League last 16.