Pentazocine is an opioid analgesic used to treat moderate to severe pains. The real analysis for the pharmaceutical products containing pentazocine is basically to ensure the correct dose and patient safety. This study developed and validated an improved high-performance liquid chromatography (HPLC) method in the selective and accurate quantification of pentazocine. Two-dimensional (2D) HPLC technique is employed to enhance the resolution and selectivity compared to conventional HPLC methods. The 2D-HPLC instrumentation consists of two C18 columns coupling with a switching valve to capture fractions from the first column, which is analyzed in the second column. The mobile phase was optimized to 45% acetonitrile and 55% water with 0.1% phosphoric acid. The method was validated in the International Conference on Harmonization guidelines and shows excellent linearity (R2=0.998), limit of detection of 1.58 μg/L, accuracy of 97.70–102.50%, and precision by relative standard deviation (RSD) of 1.02–4.20%. Selectivity was verified in resolving pentazocine from paracetamol, caffeine, ibuprofen, and oxycodone in laboratory mixtures. The utility of the 2D-HPLC method was demonstrated by accurate quantification of pentazocine in pharmaceutical injections and tablets unaffected in excipients. This research provides a rich validating technique to enhance the quality control testing of pharmaceuticals containing pentazocine.