Over the last three decades, urban agriculture has been improving food security in Cuba by providing fresh vegetables within and on the outskirts of cities and villages. However, organic fertilizers and substrates that are used in urban agriculture systems can be contaminated by trace elements and accordingly pose risks to human health. This study was carried out to measure the concentrations of cadmium, lead, arsenic, selenium, mercury, nickel, and chromium in composts and substrates used in Cuba's urban agriculture, as well as in vegetables grown in this cropping system to assess risks to human health. Extraction of trace elements from samples was performed with a mixture of nitric and hydrochloric acid in a microwave oven. Cadmium, lead, nickel, and chromium were determined via optical emission spectrometry, and mercury, selenium, and arsenic were measured using an atomic absorption spectrophotometer coupled with a hydride generation system. We demonstrated that the concentrations of trace elements in organic fertilizers, with the exception of compost from municipal solid waste, were within permissible values and do not pose risks to human health. The compost produced from municipal solid waste and the substrates prepared with this material presented cadmium and lead concentrations above maximum permissible concentrations. This work represents the first national-wide survey of trace elements in Cuban urban agriculture. As a result of this investigation, the use of municipal-solidwaste compost for food production was forbidden in Cuba.