The KOSPI index is displayed in the dealing room of Hana Bank in Seoul, Friday. The benchmark KOSPI closed at 6,977.94, up 2.42 percent from the previous session. Yonhap

KOSPI capped a weeklong rally Friday, briefly reclaiming the 7,000 level for the first time in three weeks as foreign investors piled into semiconductor stocks amid stronger sentiment toward the memory chip sector and easing U.S. inflation.

The index nearly rose 25 percent from its July 30 low.

The benchmark KOSPI closed at 6,977.94, up 2.42 percent from the previous session. The index opened 2.68 percent higher and reclaimed the 7,000 level for the first time in three weeks before giving up some of its gains as investors took profits following a five-session winning streak.

Foreign investors purchased a net 3.03 trillion won ($2.13 billion) worth of shares, while institutional and retail investors sold a net 1.02 trillion won and 1.98 trillion won, respectively.