Rare events searches, such as direct dark matter detection or neutrinoless double beta decay (0vββ) observation, using liquid xenon as target and detection medium require ultralow background to fully exploit the physics potential. Cosmogenic activation of the detector components, and even more importantly, of the xenon itself might have undesired impact on the background and the final sensitivity of the experiment. Since no measurement of cosmogenic activation of xenon was present in literature so far, we performed such a measurement exposing of a natural xenon sample to the cosmic radiation at the Jungfraujoch research station at an altitude of 3470 m above sea level for 245 days. This study was complemented with a ultra pure copper sample that was activated together with the xenon. We directly observed, with gamma-ray spectrometry, the production of (7)Be, (101)Rh, (125)Sb, (126)I and (127)Xe in xenon, out of which only (125) Sb could potentially lead to a background relevant for multi-ton scale direct dark matter search. The production rates for five out of eight radioactive isotopes in copper are in good agreement with the only dedicated measurement present in literature. The production rates measured for both samples were compared with the predictions obtained with commonly used software packages. The latter showed a systematic under-estimation, especially for xenon.