Mattresses often have one stubborn spring that, through poor design, gradual wear-and-tear or improper use, may have broken or developed an aberration. Isolating this spring is difficult without ruining the mattress. If the mattress is still under warranty, have it taken in and professionally repaired. If it is no longer covered, consider making a small incision in the fabric over the problematic spring and attempting some minor surgery such as bending the spring to remove the squeak.
Sometimes the springs of a mattress, particularly those of a cheaper design, will not need repair or replacement, just some minor lubrication to help them bounce a bit smoother. Again, isolating this spring and repairing it may be difficult.
Squeaks can sometimes be caused by a mattress laying off-center, causing the springs or other components to move at an awkward angle. If the mattress has been positioned on the box spring or slats in such a way that it is not lying parallel to the floor, shift it so that it lays flat.
Alternately, the mattress may be positioned fine, but the legs of the frame are positioned so that the mattress is angled. Balance the legs so that they are all of the same height. Or, if the floor is crooked, adjust them so that the mattress is flat.
Sometimes a bed with flats will develop friction between the slats and the mattress or the slats and the frame. This can be remedied by insulating the slats with a piece of cloth or other soft covering that can absorb the sound.
Often the fittings on a frame, especially an older one, will come loose and have to be retightened. Examine the frame for missing components and retighten the screws and fittings. This should help prevent different components of the frame from moving against each other, generating the squeak.
Sometimes the frame will be perfectly tight, but its fittings will require oiling. If it's a metal frame, apply some oil to the rivets. If it's a wood frame, try paste wax.