A traffic stop on a west Texas freeway sparked a drive-by shooting rampage Saturday afternoon, leaving at least five people dead and at least 21 more injured.

The gunman — stopped when he failed to signal a left turn — led law enforcement on a wild and murderous chase before dying in a police shootout in a movie-theater parking lot, officials said.

At one point, he ditched his gold Toyota pickup and hijacked a US Postal Service van, killing its driver.

And as he sped down Interstate 20, Highway 191 and smaller roadways, he pointed his rifle out his window, blasting away at other drivers, shoppers and pedestrians.

The name of the shooter, a white man in his 30s, was not released Saturday night.

His motive was unknown, police said.

Victims included three law local-enforcement officers, who were expected to survive, and a 17-month-old girl who was shot in the face, authorities said.

A child was among the fatalities, local school officials said.

The shootings spanned the 20 mile stretch between the cities of Midland and Odessa, which is home to a campus of the University of Texas and the famed “Friday Night Lights” high school.

The broad daylight carnage — which comes 28 days after 22 people died in a mass shooting four hours east, in El Paso — began on a stretch of I-20 between the two cities.

The gunman was pulled over by a pair of Texas Department of Public Safety officersfor failing to signal a left turn.

The gunman, the only person in the pickup, slowed without stopping, leveling a rifle and opening fire into the troopers’ patrol car.

“That’s when he shot the officer and then took off and started shooting randomly,” , Midland Mayor Jerry Morales, told CNN.

“Everything happened after that.”

The injured trooper is in serious but stable condition; his partner was not hurt.

The gunman then cut a bloody swath between the two cities, leaving chaos in his wake.

Police chased first his pickup and then his commandeered Postal Service truck.

The vehicle switch left law enforcement momentarily confused. Police from both Midland and Odessa issued Facebook alerts saying they were pursuing two shooters in two vehicles.

“Active shooter! Please share!” the Odessa Police said on Facebook.

“A suspect (possibly 2) is currently driving around Odessa shooting at random at people.

“At this time there are multiple gunshot victims. The suspect just hijacked a US mail carrier truck and was last seen in the area of 38th and Walnut,” the post said.

“ Everyone is encouraged to get off the road and use extreme caution!

“All law enforcement is currently searching for the suspect and more information will be released as soon as it becomes available.”

The youngest of the gunman’s drive-by spree victims was a toddler strafed in her car seat outside a restaurant in Odessa.

The little girl’s face, shirt and lap were drenched in blood, a worker at the Twin Peaks restaurant told the New York Times.

“She was conscious, but she was just covered in blood,” the worker, Junior Bejarano, 20, told the paper.

“It was horrible to see something like that.”

The Medical Center Hospital in Odessa confirmed that the toddler was airlifted to a pediatric center, KOSA-TV in Odessa reported.

The restaurant worker saw another victim — a woman who was hyperventilating in her car after a bullet apparently passed through it, nearly hitting her.

“She was just shaking” from fear, he recounted. “She really couldn’t talk.”

A Midland cop and an Odessa cop were both injured during the pursuit.

The television station CBS 7 was broadcasting on the shooting from its studios at the Music City Mall in Odessa when authorities ordered all staff to leave the property for their safety.

The University of Texas Permian Basin campus remained on lockdown during the chase, and afterward offered counseling.

The gunman was still driving the hijacked postal van when he was taken down.

“We saw him speeding down a road behind the theater,” eyewitness Simona Rivas told The Post.

Rivas, her husband Joe and her 16-year-old son, Adriel, had been watching the movie “Bad Boys” when the Cinergy movie theater in Odessa was evacuated.

Outside, they saw the van plow into a crowd of officers and police vehicles who were blocking his way.

“He was still driving when they started shooting at him,” Rivas said.

“He came to a stop when he crashed into the police cars,” she said.

“There was SWAT everywhere, Machine guns everywhere.”

She added, “He was heading right past a field filled with around a hundred people” who’d also been evacuated from the theater. They dove to the ground.”

Vice President Mike Pence spoke of the shooting to reporters as he boarded a plane to Poland.

“Our hearts go out to all the victims and families who had loved ones lose their lives,” he said.

“We commend the law enforcement in Odessa for their swift and courageous response, but at the President’s direction we’ve deployed the full resources of the federal government.

“They’re on site. The president spoke to the attorney general. The FBI is already assisting local law enforcement in the investigation going forward,” Pence said.

Additional reporting by Eileen AJ Connelly, Brad Hamilton and Kathianne Boniello

With Post Wires