A Tesla owner is thanking his Model X’s Autopilot system on Tuesday, after his electric car saved him from what could have been a major side collision with a swerving semi truck.

The driver of the Model X, Jeremy Visnesky, uploaded the dashcam footage of the incident on YouTube. According to Jeremy, he was driving with Autopilot engaged on I-95 south through NC when a semi-trailer came way too close for comfort while it was overtaking him. What’s worse, the driver of the truck appeared to lose control of the massive ICE vehicle for a moment, causing the long-hauler to swerve into his Model X’s driving lane.

A Tesla Model X on Autopilot avoids a near collision with a swerving semi truck. [Credit: Jeremy Visnesky/YouTube]

Fortunately for the Tesla owner, the Model X’s Autopilot detected the truck’s behavior just in time. As soon as the truck began to swerve, Autopilot intervened, steering the electric SUV away from the semi-trailer. As soon as the driver of the truck was able to gain control, the driver-assist system guided the Model X back into its original driving lane.

In the video description of his YouTube video, Jeremy stated that if Autopilot had not reacted the way it did, he would have been sideswiped by the swerving truck.

“I-95 south driving through NC and a semi decided to nod off or play with his phone or something. Had Autopilot not have bolted to the side, I’m pretty sure he would have hit me,” the Model X owner wrote.

Just last month, we covered a near-accident involving a Tesla Model S on Autopilot saving its driver from a head-on collision in Switzerland. During that particular incident, the Model S was traveling at 50 mph when it detected a Ford Kuga overtaking a tractor in a daring maneuver. To the shock of the Model S driver, however, a Volkswagen Beetle was actually behind the Kuga, and it, too, was pushing to overtake the tractor. Thanks to the Model S’ forward collision warnings, however, the Tesla driver was able to react appropriately and avoid what could have been a catastrophic head-on collision.

In a post on the r/TeslaMotors subreddit, the Model S owner stated that he was particularly impressed with his vehicle’s suite of sensors, which were able to identify that a car was out of its lane even before it became visible to him.

“The AP was well aware of the Kuga being in MY lane at that distance! The radar alone can’t tell if the echo is in the correct lane (any normal oncoming traffic) or not,” the Model S owner wrote.

In the case of the recent incident, the Model X’s steering intervention ultimately became the factor that determined if the electric SUV would get sideswiped or not. While this is impressive, however, the Model X’s Owner’s Manual states that drivers should not rely only on steering interventions to avoid side collisions.

Watch Jeremy Visnesky’s Model X avoid a swerving semi-trailer in the video below.