It could also aid the recovery of people with heart disease.
The research revealed that when people listen to their favourite music, endorphins are released in the brain which improves their hearts’ health.
The researchers, from the University of Nis, Serbia, found that music with no lyrics is the best as words can be emotionally upsetting, The Daily Telegraph reports.
To carry out the study, the researchers split a set of 74 people with heart disease into three groups.
One group was sent to exercise classes for three weeks, another was sent to exercise classes but was also told to listen to music for half an hour every day, and the third group was asked to listen to music but did not attend exercise classes.
The participants were all studied again at the end of the three week period and the researchers discovered that the heart disease patients who had exercised and listened to music improved significantly.
They displayed improvements in heart function and their exercise capacity had increased by an average of 39 per cent.
In contrast, the group that exercised but did not listen to music only saw their exercise capacity - the maximum amount of physical activity a person can sustain - increase by 29 per cent.
Surprisingly, the group that listened to music, but did not exercise, also saw their exercise capacity increase by 19 per cent.
The researchers believe that the improvements can be put down to the release of hormones while listening to music.
Lead researcher, Professor Deljanin Ilic said: ‘The combination of music and exercise training led to the most improvement in [heart] function. Improvements in [heart] function were associated with significant improvements in exercise capacity.’
She added: ‘Listening to favourite music alone and in addition to regular exercise training improves [heart] function and therefore may be an adjunct method in the rehabilitation of patients with CAD [coronary artery disease].
‘There is not an “ideal” music for everybody and patients should choose music which increases positive emotions and makes them happy or relaxed.’
Professor Ilic believes that, while the study only involved people with heart disease, the findings suggest that people without a heart condition would also benefit from listening to music which makes them happy and relaxed.