Unlike some other odors, cigarette smell tends to linger, especially in furniture and fabrics. Since you can't throw the mattress in with the next load of laundry, removing that stale odor requires more hands-on attention, along with time and fresh air.
Remove all the bedding and pillows from the bed.
Sprinkle baking soda liberally over the mattress surface. Open all the windows in the room if possible. Turn on a ceiling fan or place a box fan in a window to draw air out of the room. If it is cold outside, close the door leading to this room to avoid drawing heat out of the rest of the home.
Allow the baking soda to sit for several hours, then vacuum it. If the mattress still smells strongly of cigarette smoke, sprinkle more baking soda on it and air it out with the windows open overnight. If it is too cold to keep the windows open, close them after an hour or so after removing the box fan.
Place a bowl of vinegar in the room near the mattress, such as on top of a nightstand, allowing it to absorb lingering odor while you utilize other rooms of the home.
Mix equal amounts of vinegar and water in a misting bottle, or a spray bottle that emits a fine mist, if the mattress still smells of smoke. Replace the bottle's top and spritz the mattress thoroughly with the liquid, using enough to coat the surface lightly without soaking it. If you are concerned about the moisture, wipe much of it away after a minute or two using a lint-free white cloth. Allow the mattress to air dry for at least several hours before placing bedding on it.