Building brand loyalty has become essential, particularly for sportswear brands in the age of social media. As one of the countries committed to increasing the trend of healthy lifestyles, Indonesia provides opportunities for sportswear brands to grow. This study aims to investigate how social media marketing affects brand loyalty, together with cognitive engagement and brand trust as mediators. An online survey was conducted with 350 respondents and the PLS-SEM method was used for analysis. The results show that social media marketing positively affects cognitive engagement, brand trust, and brand loyalty. Furthermore, both cognitive engagement and brand trust positively affect brand loyalty and act as mediators in the relationship between social media marketing and brand loyalty. This study contributes to marketing literature by highlighting the role of cognitive engagement and brand trust in influencing brand loyalty. It provides strategic recommendations for sportswear to enhance its digital marketing efforts. These include creating interactive and engaging content, maintaining transparency and authenticity communication to customers, leveraging credible influencers, and using data-driven insights to personalize content.