All lanes of Carpenter Upchurch Road between Green Hope High School and Heritage Pines Drive were closed as precaution while CSX worked to solve the problem.
There were no injuries or hazardous materials issues associated with the derailment.
Officials said two of the rail cars were leaning. The train was going from Apex to Durham when the cars jumped the tracks. They were carrying paper products.
Police are advising motorists to use alternate routes throughout Wednesday evening and overnight. Officials expect the work to be complete prior to morning rush.
Green Hope High School may be accessed by using Louis Stephens Drive.
The cause of the derailment is under investigation.