Firefighters had to secure the car using a winch after it was left in a precarious position, before helping the man out of the vehicle.
In a statement, the Fire and Rescue Service said: 'A motorist had a lucky escape after his car left the road in the early hours of this morning, leaving him trapped in a precarious position.
'Had a tree not stopped the car, this could have potentially been a fatal incident.
'Fire crews secured the car using a winch, assisted the trapped man out from the car, before recovering the vehicle to the roadside. Police are investigating the cause of the accident.'