A truck has crashed and burst into flames, closing a major highway in the Blue Mountains.

A 26-year-old truck driver escaped from his vehicle just before it burst into flames, closing a major highway in the Blue Mountains.

The truck, carrying a load of cotton, was travelling eastbound on the Great Western Highway at Mount Boyce, when it hit a median concrete barrier early on Thursday morning (AEST), police said.

The highway is expected to remain closed in both directions between Mount Boyce and Mount Victoria for several hours as workers remove the truck.