A Ryanair flight was forced to make an emergency landing after coming within minutes of running out of fuel in flight.