A rail car loaded with lithium batteries caught fire in the Cajon Pass early Wednesday, authorities said.