(Taking a bit of a stab here, but let's see if I can clear things up a bit.)
The best definition of "Magic" i could find in a PF source is from the PathfinderWiki:
Magic is a naturally-occurring force used by many of Golarion's inhabitants. It is practiced in many different forms, with different ends and abilities, but it is almost always characterized by the use of words or gestures of power (and often expended material components) and the external production of some supernatural effect, be it arcane, divine, or psychic in nature. [Emphasis mine]
Thus it can be inferred that "Magic" is an existing force of the universe, maybe akin to gravity but more easily manipulated. Therefore "Spells" are those "one-time effects", temporary occurrences of magic channeled by creatures capable of wielding magic. It can also be inferred where magic comes from by examining the descriptions of different casting classes and what ability score they use as their casting stat.
We'll start with arcane casters: Wizards, Sorcerers, Magi, Arcanists and Bards. Arcane Magic seems to be less well-defined in official sources than Divine Magic.
Wizards, Magi and Arcanists use their INT for their casting stat. Whatever the source of magic is, they rely on long-term and intensive study of it to master its subtleties. It is implied that these classes are sort of like the physicists of magic, putting their studies into practice by harnessing the forces of the universe itself and bending it to their will.
Sorcerers and Bards use their CHA for their casting stat. The source of a sorcerer's magic is explicitly explained:
Scions of innately magical bloodlines, the chosen of deities, the spawn of monsters, pawns of fate and destiny, or simply flukes of fickle magic, sorcerers look within themselves for arcane prowess and draw forth might few mortals can imagine.[...] these magic-touched souls endlessly indulge in and refine their mysterious abilities, gradually learning how to harness their birthright and coax forth ever greater arcane feats [Emphasis mine].
A sorcerer uses their charisma, their own force of will and sense of self, to harness an internal power granted to them usually by inheriting some traits of their outsider/divine/infernal/cursed/draconic/etc. parentage or ancestry. Since a sorcerer's magic is not directly granted by a deity but something natural and inherent, it is considered arcane. Bards resort to their cleverness and force of will to accomplish a similar feat; less studious and more intuitive than the Wizard's/Magus's intensive study but producing the same reality-manipulating effect.
Conversely, the general source of Divine Magic is explicitly explained:
Unlike arcane spells, divine spells draw power from a divine source. Clerics gain spell power from deities or from divine forces. The divine force of nature powers druid and ranger spells, and the divine forces of law and good power paladin spells.
Clerics and Druids use their Wisdom as their casting stat. This implies they draw on a profound intuitive, instinctual or enlightened understanding of the world or their patron deity to manipulate magic. These abilities are granted to them by some higher power lending them its strength.
Paladins and Oracles use their Charisma as their casting stat. While paladins channel their ability to cast through the force of their staunch moral beliefs, Oracles (like Sorcerers) rely on their sense of self to control their inherent magic (still granted by some higher power but less direct than the attention given to Clerics).
Witches are a strange corner-case of hybrid arcane and divine magic. They use their Intelligence as their casting stat. By deepening her understanding of hr "Patron" power source, a witch expands her abilities.
the witch draws her magic from a pact made with an otherworldly power. Communing with that source, using her familiar as a conduit, the witch gains not only a host of spells, but a number of strange abilities known as hexes. As a witch grows in power, she might learn about the source of her magic, but some remain blissfully unaware. Some are even afraid of that source, fearful of what it might be or where its true purposes lie.
I do not believe it is explicitly explained where the Gods get their power other than having ties to the very beginnings of reality and being a sort of intelligent manifestation of the universe itself (no quote, unfortunately, I'd have to sift through a lot of fragmented lore to justify this one). The intro to the PF book Gods and Magic gives some hints:
Creators of life, forgers of worlds, and rulers of reality—these are the gods and goddesses of the world. They have existed for eons. The countless worlds of the Great Beyond are their playgrounds and battlefields. [...] It is through their priests and paladins, their clerics and cultists that the gods make their will known in this world, be it for good or ill.
Personally, I was always under the impression that beyond their cosmic origins, Gods (in any mythological sense, not just PF) in part draw their power from their worshipers. Gods fade away and die out when their sects fail and there is no one left to empower them. In a lot of PF lore and item descriptions (again scattered) it is shown that the Gods can be killed by creatures of similar power (epic level PCs, other gods, etc.) so while they are ageless they are not necessarily indestructible.
I hope that helps in some way, And if not I hope it was at least interesting.