Coronal mass ejections (CMEs), often associated with flares, are the most powerful magnetic phenomena occurring on the Sun. Stars show magnetic activity levels up to 10^4 times higher, and CME effects on stellar physics and circumstellar environments are predicted to be significant. However, stellar CMEs remain observationally unexplored. Using time-resolved high-resolution X-ray spectroscopy of a stellar flare on the active star HR 9024 observed with Chandra/HETGS, we distinctly detected Doppler shifts in S XVI, Si XIV, and Mg XII lines that indicate upward and downward motions of hot plasmas (~10-25 MK) within the flaring loop, with velocity v~100-400 km/s, in agreement with a model of flaring magnetic tube. Most notably, we also detected a later blueshift in the O VIII line which reveals an upward motion, with v=90+/-30 km/s, of cool plasma (~4 MK), that we ascribe to a CME coupled to the flare. From this evidence we were able to derive a CME mass of 1x10^21 g and a CME kinetic energy of 5x10^34 erg. These values provide clues in the extrapolation of the solar case to higher activity levels, suggesting that CMEs could indeed be a major cause of mass and angular momentum loss.