Like most health issues, it requires a little more information to answer with any authority.
If you mean muscle pain in your lower back, then doing gentle rotation stretches with the painful side down (lying on sore side, shoulders flat, opposite leg rolling over to floor) can open up the painful side of the spine which means less joint and nerve compression, and less pain.
Coupling this with some core exercises (exercises utilising the deep abdominal and lower back muscles to stabilise spine while adding challenges to body position) like bridging with your feet on a fitball (laying on your back) or simply position yourself on hands and knees with knees together and try to raise one arm at a time without moving your trunk or hips side to side (harder than it sounds). Ensure you're only engaging the deepest muscles by "drawing" lower belly in, don't tense/brace or bear down.
If your pain is more in the upper back it could be postural, so being more aware of time spent on devices (facebook-itis), or computer, and doing regular stretches for your Pec muscles (arms up on corner of room and lean in) and postural holds (back against a wall, pull shoulders and head back gently until you feel tightness between shoulder blades) and holding for a minute, several times throughout the day. If you're a gym type person, add in some seated row, reverse flies or similar back exercises to strengthen the muscles that support this area.
Don't forget the foam roller and spiky ball - while painful to use they can be really useful at releasing myofascial trigger points and mobilising a stiff spine.