From the Spanish word "Puto", which means faggot or gay. When it is used as "Masputo", it means something that is REALLY, REAllY gay. In his stand-up act, George Lopez: America's Mexican, he mentions puto as in being gay and masputo as an even gayer form of puto.
The use of the word "blue" to refer to sexually explicit content was first recorded in Scotland in 1824. "Blue" meant "lewd" because prostitutes dressed in blue gowns.