Was he really any good at magic, or was he just lucky (as the book seems to imply) and he had very good and powerful friends to back him up?
Harry is neither particularly "good" or "lucky". He is the opposite of a tragic hero.
Maybe "opposite" is incorrect, but Harry's story is basically one of love conquering hate. While Voldemort is consumed with hate, Harry's life was altered by love in positive ways.
Not only did love save his life, quite literally apparently. It also bound Harry to Voldemort in such a way that it ensured the "dark lord's" eventual defeat.
Harry isn't "lucky" to have friends, he has them for a number of reasons, mostly because of the kind of person he is, and how he values his friends. Unlike the person opposite of him in this respect "Draco". Draco's friends are a stark contrast to Harry's. Not the point.
Anyway, so, while he has some magic skill, albeit not super powered like some characters, he also doesn't simply stumble through life with unexpectedly happy results. A tragic hero is somewhat destined to fail with love as some complicating factor, while Harry's destiny was somewhat written by love to various extents.
So, yes, Neither.
To some degree, both.
Harry was a talented wizard, though not a particularly good student. He excelled specifically at Defense Against the Dark Arts, managing to summon a corporeal patronus in his third year (a feat that many adult wizards aren't capable of). He didn't excel in the classroom in the way that Hermione did, but I think that is due more to personality than ability. And, of course, focusing on stopping Voldemort, or his supporters, during the course of every school year no doubt didn't help with his studies.
His magical ability certainly helped him through some of the situations he found himself in. Where his knowledge or ability failed him, he was fortunate enough to either have more knowledgeable people there to assist him or to simply get lucky.
Harry was both lucky and good at magic. Harry as a child had a lot of magical power being able to use magic in a state of extreme emotion.
Luck: Harry was lucky in a lot of situations such has the Voldemort killing the Horcrux, Faweks healed the basalisk wound. The Hippogryph respecting him. Even flying he was abnormally talented. Basically Book 5 or 6 (luck potion). He got Snape's book.
Talent: He recieved a score higher than Hermione in the Defense of the Dark Arts class.
All it comes down to is that the main character is lucky to be talented/ have good support.
He does have skill but it is never emphasized enough for a person to buy into the idea that he has more extraordinary talents at all.
He did not seem to grasp many spells in the first book and only learned useful ones later on like the Disarming Charm in the second book and the Patronus Charm in third book. Also in the third book Harry does excel at Defense Against the Dark Arts but most of that knowledge apart from spells was not used in the series.
While he learns more spells in the fourth book they were just spells anyone can learn to cast but throughout the series (if you have already read), he does not dabble or experiment, making him really just average, too average.
Frankly there were many instances of Deus Ex Machina, some of which were foreshadowed like in the first book Voldemort's Killing Curse rebounded on Harry and we learn why because of the his mother's love protection charm. And this in turn allowed him to defeat Quirrell and Voldemort very quickly.
In the second book Harry gets help from Fawkes, thanks to some information Dumbledore provided, even though its not clear whether or not phoenixes have very good hearing.
In the third book he uses the Time Turner (which gave Hermione the mysterious ability to appear at more than one places) to save Sirius.
In the fourth book Harry was saved by effect of the twin cores which was mentioned in the first book.
The seventh book uses the wandlore idea that the wand chooses the wizard to allow Harry to gain the Elder Wand without really knowing it. It was mentioned in the first book but was not quite expanded-on properly although it was most likely to keep things mysterious. And also in the seventh book Harry's wand saves him from Voldemort all on its own even though such a level of wand sentience was not touched upon often making genuine instance of Deus Ex Machina.
He is a great wizard, but it is mostly luck.
- Volume 1: Harry gets lucky that his mom's enchantment is still intact, and Voldemort can't touch him.
- Volume 2: Harry gets lucky that Fawkes shows up and saves him from the venom.
- Volume 3: Harry doesn't get lucky, and lets the only antagonist of the movie, Peter Pettigrew, escape.
- Volume 4: Harry gets lucky that the ghosts (I know they're not technically ghosts) show up to distract Voldemort so he can escape.
- Volume 5: Harry gets lucky that Dumbledore shows up to fight Voldemort so he won't have to.
- Volume 6: Harry gets lucky that Dumbledore revived in time to save Harry from the inferi.
- Volume 7: Harry gets lucky that all the events led to him being the owner of the elder wand, so the wand backfires Voldemort’s curse back to himself that definitely would've killed Harry.
Harry found at least once that he used magic he didn't know or intend to use when his life was threatened, when he was flying with Hagrid away from the Dursley's - there may have been other times as well. It seems the horcrux was protecting itself. I don't think everything he did or was capable of, including destroying Voldemort, can be chalked up to luck and skill - the horcrux Voldemort unintentionally placed within Harry played a significant role.