In Independence Day, the aliens are defeated by a computer virus uploaded to their mothership by Captain Steven Hiller (Will Smith) and David Levinson (Jeff Goldblum).
Levinson crafts the virus to interface with alien technology. Once uploaded, it disables the invaders' force fields and weapon systems, allowing human forces to destroy the mothership and the attacking fleet.