My brother considered doing this altho the route he wanted was to fly into Barcelona, spend a few days there then travel to Condado.
He found it could take between 9.5 hours and 14 + hours to travel by train to Mazarron depending on what time he chose to leave Barcelona. Then he'd have needed a taxi or hire car from Mazarron to Condado.
At that point he changed his mind.
Other info from :www.rome2rio.com/s/Barcelona/Mazarrón
As an alternative- if you are just wanting to visit a Spanish City, we did the journey from Valencia in 3.5 hours by car, which included a couple a refreshment stops.