I'm currently playing it and from what I understand, stronger enemies level up your weapon/magic levels faster.
Example: using Cure multiple times will level it up. Same for different spells. Attacking levels up weapon level.
Using spells increases your magical stats, attacking/defending increases physical stats and HP can be gained at regular intervals if you have the boost turned on.
I still don't completely understand it but that's what I've figured so far.