The Korea Composite Stock Price Index (KOSPI) ended up 0.3 percent at 1,981.19.
The sub-index for security stocks rose 3.7 percent.
Foreigners were net sellers, dumping a net 114.1 billion won ($96.95 million) worth of KOSPI shares on the day, having slashed a net 3.1 trillion won from their portfolios in the previous 13 sessions.
The South Korean won closed local trade up 0.5 percent at 1,177.6 per dollar, reversing a three-day losing spree. It extended gains in afternoon trade, supported by China's firm yuan.