Some good advice already posted.
What helmet are you using? My wife used her mountain bike helmet which had a visor on it. This gave here neck pain. We took the visor off and her pain went away on the next ride.
"Ride more" worked for me. I raised my bars initially and used a shorter stem, eventually, as I got used to road riding, I went back to a longer stem and then eventually flipped the stem down. If I planning a ride over 4 hours then I still sometimes flip the stem up.
edit: this all refers to upper back / neck muscle ache. If my spine hurt I would see a doctor.