This work presents a cointegration-based pair-trading strategy for identifying stock pairs with substantial cointegration in their prices across four years (January 1, 2018, to December 31, 2021). After the Cointegrated pairs are determined, pair-trading portfolios are created, and portfolio performance is tracked during a one-year test period (January 1, 2022, to December 31, 2021). Suitable trigger points are determined utilizing a very powerful spread detection system, allowing both stocks’ short and long positions to be precisely recognized. The yearly return of a portfolio is used to assess its performance. First, twelve sectors of stocks from the National Stock Exchange (NSE) of India are selected. According to the NSE’s monthly report for the month of December 31, 2022, the top ten stocks in terms of their free-float market capitalization from the twelve sectors are selected. Pair trading portfolios are built using pairs from each sector that demonstrated cointegration of close prices from January 1, 2018, to December 31, 2021. The portfolios are evaluated based on their return from January 1, 2022, to December 31, 2022. Furthermore, clustering-based techniques were used to identify stocks that behaved similarly for the period of four years i.e., January 1, 2018, to December 31, 2021. This was performed by using three clustering techniques and the best technique, based on their respective results, was chosen to identify the clusters to verify the cointegrated pairs. Henceforth, the pairs which were common in both cointegration, and clustering techniques were regarded as the most recommended pairs for trading. The work makes three distinct contributions. First, the paper provides a cointegration-based pair trading strategy for stock portfolio creation, that can be used to earn profit by the investors in the stock market. Second, the pair-trading models are trained and tested on real-world stock market data, with the results displayed to illustrate the models’ efficacy. Finally, since the stocks utilized in the pair trading portfolio designs are drawn from various NSE sectors, the outcomes of the pairings are an excellent signal of the possible profit that investors could make if they invest in those sectors using the recommended pair-trading technique.