It happens to everyone. 6 hours is a long time.
1. get the bike set up right. I don't necessarily mean professionally, but get the seat (height and fore-aft) and the bars (height and stem length) in about the right place. I do my own static fit, using heel on pedal and then a plumb line from under my knee cap. Stem length adjusted to make front hub invisible when I'm on the hoods.
2. Do what the others say above... Do some core-muscle and flexibilty stuff. Nothing too major, but slowly build a little strength and flax.
3. Give yourself the option to move your arse on the saddle and your hands on the bars. Between those two, you'll have the chance to stretch your back.
4. And this sounds absurd but can be surprisingly effective. If your back feels stiff, ride along pushing your arse backwards and feeling as if you are arching your backin a really exaggerated way. Arms straight, hands on hoods, arse to rear of saddle and shoulders back - to sort of make a parabola of your spine. You'll feel slightly silly, but it will sort your back out in no time.