Catalonia (Spain) has a significant potential of biogas production from agricultural activities and municipal waste. In addition, there are plenty of industrial cogeneration plants, but most of them use conventional fuels, such as natural gas, and conventional energy conversion devices, such as internal combustion engines. Molten carbonate fuel cells are ultraclean and highly efficient power generator devices capable of converting biogas into electricity and heat. Located in Lleida (Catalonia), Nufri is a fruit processing company with a long tradition on biogas production and cogeneration, with an installed capacity bigger than 45 MW. This study analyzes the economic viability of a fuel cell operating on biogas in Spain, on a real case basis (Nufri). Different fuel cell capacities are analyzed (from 300 kW to 1200 kW). A parametric study of different fuel cell prices ($/kW installed) is performed. Additional biogas cleanup requirements are taken into account. The results are based on the Spanish legislation, which establishes a special legal framework that grants favorable, technology-dependent feed-in premiums for renewable energy and cogeneration. Results show that the payback period ranges from 5 years to 8 years depending on the fuel cell capacity and installation price.