get a new mattress and a good one. Do some spine exercises on the edge of the bed when you get up. Your spine looses the lubricating fluids in the disks when you sleep and you need to open up the vertebrae to let the fluids back in. Do the lightly and don't over do it.
I have the same most mornings, new mattress didn't help, nor sleeping with a pillow between legs, dr refered me to physio who just gave me a list of same exercises I'm already doing for back! it does tend to get better as the day goes on, but it doesn't help other health problems if not able to get a good nights sleep.
It is 0330 awake with pain took sleep meds and extra pain meds . I nearly always wake up with pain and it takes time for it to settle after taking my SR Tramadol. I just go with the flow I have no choice I try to not let it start my day off on the wrong foot.