Social Security provides essential benefits for millions of retirees. But those who receive government pensions that weren't funded by Social Security could lose some of their spousal benefits, due to a little-known Social Security provision called the government pension offset.

In the following video, Dan Caplinger, The Motley Fool's director of investment planning, explains the government pension offset and how it affects you. In general, if you get an outside pension, your Social Security survivors' or spousal benefits can be reduced by two-thirds of what you receive from the pension. Dan notes, though, that if you were paying Social Security taxes on the wages from that government job, you can be exempt from the government pension offset. Dan concludes that the purpose of the rule is to avoid double-dipping, but it can still come as a huge shock to many retirees.