Survivor benefits are available for certain family members as long as you accumulated the 40 credits before dying.
Your children may qualify for 75% of your Social Security benefits based on your record of contributions, up until they turn 18 years old (or 19, in the case of a child still in elementary or secondary school). As for your spouse, he or she can receive a reduced benefit (71.5% of your benefits) as early as age 60, or your full benefit after reaching full retirement age. Those benefits will continue indefinitely unless your spouse remarries.
Benefits for your spouse and kids are also limited by a family maximum, which is the maximum amount that can be paid from your earnings record. For more details on survivor benefits, check out the Social Security Administration's Web site.