The Battle of Yavin was a fictional battle during the Galactic Civil War in the Star Wars film saga. The opposing sides were the Galactic Empire and the Rebel Alliance.

The battle was arranged after the crew and passengers of the Millennium Falcon seemingly successfully escaped The Death Star along with detailed schematics of the massive space station as well as Princess Leia Organa. However as Leia suspected, they were actually allowed to escape by the Empire so as to follow them to the main Rebel base which turned out to be on the planet of Yavin 4.

Studying the plans, the Rebels learned that the station had an small exhaust port to the main reactor which could allow a weapon to reach it and set off a massive explosion that could destroy the station. However, the port was only 2m wide and situated in a narrow trench which would have to be navigated through enemy defences to reach. Furthermore, the port was ray shielded so only proton torpedoes could be used. There was little confidence that the weakness could be exploited in such conditions.

However, The Death Star soon arrived and was maneuvering for firing its main weapon so the proposed battle plan was used. A fleet of 30 X-Wing and Y-Wing starfighters, which included Luke Skywalker (designated Red 5) as a pilot scrambled to assault the station. The Death Star attempted to use its batteries to defend itself, but the defences were designed to fight off primarily capital ships, not the small and difficult targets the starfighters were. The station commander, Grand Moff Tarkin dismissed the attack as futile, but Darth Vader, realizing the threat this force was, ordered his personal fighter squadron to scramble.

During the battle, the casualities were heavy with 90% losses both from station guns and Darth Vader's squadron. When the first bombing run proved unsuccessful, the remaining fighters -- three X-Wings and one Y-Wing -- lined up for the second attempt. Darth Vader pursued and picked them off one by one. To the Rebel Command, all seemed hopeless; time was running out with the Death Star getting into firing position, almost all the fighters were lost and the remaining pilot able to make the run, Skywalker, had senselessly deactivated his targeting computer during his run. However, there was a method to Luke's madness; he was advised by the spirit of Obi-Wan Kenobi to use The Force to make the seemingly impossible shot.

Vader, sensing that the last pilot was strong in The Force, prepared to kill him. However, at the last second, Han Solo and Chewbacca of the Millennium Falcon, surprised Darth Vader and sent him careening out of control into space. Luke made the shot, and with The Force aiding him, his torpedoes entered the port perfectly. During this time, Tarkin was warned that the Rebels' attack posed a threat, but Tarkin refused to take it seriously and remained on the station. As a result, Tarkin and his staff were killed when the Death Star exploded and the Rebel Alliance won a spectacular victory.

As a result of this battle, the Rebel Alliance gained credibility as a legitimate military opponent to the Empire. However, the Rebel Alliance still had to evacuate Yavin IV to escape Imperial retaliation and eventually settled on Hoth.

The battle, as depicted in the film Star Wars Episode IV: A New Hope, is based heavily on the battle scenes in the British war film The Dam Busters.