The 71-year-old stage and screen star is best known for his Shakespearean roles, as well as his portrayals of the wizard Gandalf in "The Lord of the Rings" movies and the villain Magneto in the "X-Men" blockbusters.
The actor said he was "very gratified" to get the award "because it's not just for a character but for a career."
"Usually I say my favorite character is the one I'm doing at the moment," the British broadcaster quoted McKellen as telling reporters. "But I'm not working at the moment, so my favorite character is me. ... (Although) Gandalf is a wonderful character -- I'm a big fan of Gandalf."
Meryl Streep and Antonio Banderas shared the Donostia award at last year's film festival.
Notable deaths of 2014 [PHOTOS]