The bill by Sen. Alan Lowenthal (D-Long Beach) prohibits vendors including restaurants and grocery stores from providing prepared food in expanded polystyrene containers.
Supporters say banning foam containers will help combat litter and protect the environment, while others say the ban could hurt businesses.
The /*California Chamber of Commerce*/ says the bill threatens hundreds of jobs at California companies that make the foam containers.
Under an amendment to the bill, the ban would apply to restaurants and vendors after Jan. 1, 2016, and to schools after July 1, 2017.
Currently, 50 California local jurisdictions, along with Seattle, Wash., and Portland, Ore., restrict using the containers, but the bill would make California the first to enact a statewide ban.
Lowenthal said the material commonly known as Styrofoam often winds up as litter and eventually breaks into pieces so small that some marine animals mistake it for food.
The measure passed on a 21-15 vote, with no votes to spare.
The Associated Press contributed to this report.