The effect of shielding solar ultraviolet B radiation on the accumulation of some flavonoids and their precursor hydroxycinnamic acids in tomato (Solanum lycopersicum) was evaluated by liquid chromatography-electrospray ionization tandem mass spectrometry (LC-ESI-MS/MS). In particular, flesh and peel of two tomato hybrids, DRW 5981 and Esperanza, were separately analyzed. The hybrids have been chosen for their different responses to the light, since it was previously reported that they show different pigmentation and opposite behavior under UV-B in terms of carotenoids and ascorbic acid content at different ripening stages. To determine the effect of UV-B radiation during tomato ripening, we also measured the expression of some flavonoid biosynthetic genes by realtime reverse transcription-polymerase chain reaction (RT-PCR) analysis. The results allowed us to conclude that UV-B radiation deeply and differentially affects the content of the considered flavonoids and hydroxycinnamic acids as well as the expression of some of their biosynthetic genes in both flesh and peel during the ripening process. On the other hand, the collected data clearly showed that this influence varies between different genotypes. We conclude that the use of specific plastic covers able to eliminate UV-B radiation may be an environmentally friendly approach to modulate the expression of structural genes and, in turn, to enhance healthy antioxidant compounds in fruits of specific tomato cultivars.