Nicotine is a potent chemical that excites the central nervous system and refreshes people. It is also physically addictive and causes dependence. To reduce the harm of tobacco products for smokers, a law was introduced that requires tobacco product containers to be marked with the amount of nicotine as well as tar. In this paper, an online stacking capillary electrophoresis (CE) method with cation-selective exhaustive injection sweeping-micellar electrokinetic chromatography (CSEI-sweeping-MEKC) is proposed for the optimized analysis of nicotine in tobacco. A higher conductivity buffer (160 mM phosphate buffer (pH 3)) zone was injected into the capillary, allowing for the analytes to be electrokinetically injected at a voltage of 15 kV for 15 min. Using 50 mM sodium dodecyl sulfate and 25% methanol in the sweeping buffer, nicotine was detected with high sensitivity. Thus, optimized conditions adapted from a chemometric approach provided a 6000-fold increase in the nicotine detection sensitivity using the CSEI-sweeping-MEKC method in comparison to normal CZE. The limits of detection were 0.5 nM for nicotine. The stacking method in combination with direct injection which matrix components would not interfere with assay performance was successfully applied to the detection of nicotine in tobacco samples.