McGregor, 41, was described as "one of the finest actors of his generation".
"It was amazing arriving and feeling the wave of love from Spanish filmgoers," McGregor said, adding: "Thank you".
The Donostia Lifetime Achievement Award was created in 1986. Other actors who have received the accolade include Robert De Niro, Al Pacino, Meryl Streep and Woody Allen.
McGregor was at the festival to present his latest film, The Impossible. Directed by Juan Antonio Bayona and starring Naomi Watts, the
true story is based on a family that survived the 2004 tsunami in
The San Sebastian festival runs in Spain's Basque region until Saturday.
John Travolta, Tommy Lee Jones and Oliver Stone have also been given lifetime achievement awards at this year's festival.
Also reported by Hollywood Reporter
On 28 September, Ewan tweeted a link to the ceremony