He first appeares in the movie Thor, waiting for Agent Coulson to give him the orders to shoot Thor. Coulson later changes his mind and tells him to abort.
Barton appeared in The Avengers in which Loki had control over his mind. He is later freed from Loki's mind-control when Black Widow hits him really hard on the head. Upon recovering from the ordeal, Barton vowed to put Loki down, going so far as to propose an arrow to the Asgardian's eye socket. To that end he willingly grabbed his equipment and offered to pilot Captain America and Black Widow to Loki's location, which had been determined as New York City. Once there, the trio formed up with Thor Odinson, Bruce Banner and Tony Stark, to fight Loki together.
The group quickly found themselves embroiled in a battle for NYC against a huge invasion force of Chitauri, whom Loki summoned using the Tesseract. Barton, now using his codename "Hawkeye", initially fought the alien warriors on the streets before switching to a higher vantage point atop a high-rise building to snipe at the alien air support. At one point he even took a shot a Loki, and although the aim was true, Loki simply snatched the arrow from the air before it struck. Hawkeye had planned in advance however, and had rigged the arrow with an explosive head that knocked Loki's transport out of the sky.