Here's my very basic explanation:
1. GPS tells the aircraft its position on earth (doesn't control altitude, its barometer does that)
2. Compass tells the aircraft which way is North. They work together to keep the aircraft hovering in one place.
3. See attached diagram; In this example...