By Neil MacLucas and Chiara Albanese

ZURICH--The Swiss National Bank and the People's Bank of China have agreed to set up a currency swap line designed to boost trade and investment between the two countries, joining a parade of countries hoping to become offshore hubs for trading the yuan.

The Swiss and Chinese central banks Monday said the three-year agreement will allow them to buy and sell their currencies up to a limit of 150 billion yuan, also known as renminbi, or 21 billion Swiss francs ($23.4 billion). Such swap lines allow central banks to buy currencies from one another, making it easier for banks in each country to get hold of the underlying currencies when they need them.

The deal will also allow the SNB to buy up to 2 billion francs worth of Chinese bonds, helping it diversify its foreign-exchange reserves, which have swelled to almost 450 billion francs.

"Switzerland has taken a long time to figure out how it wanted to be involved with China but it is not lagging behind now. It has actively progressed to the second stage of the process, which is to bridge the gap between onshore and offshore markets, especially on the infrastructure side," said RongRong Huo, head of renminbi business development for Europe, the Middle East and Africa at HSBC Holdings PLC.

The Swiss franc offers China a strong, haven currency as an alternative to the euro, she said.

For Switzerland, the effort to promote yuan trading "is a country push rather than a location push, as the country is actively promoting both Zurich and Geneva," Ms. Huo said.The Swiss central bank, based in Zurich, said the agreement will further strengthen collaboration between it and its Chinese counterpart and is a "key requisite for the development of a renminbi [yuan] market in Switzerland."

The Swiss Department of Finance welcomed the agreement, which it said represented a key precondition for expanding trade in yuan in Switzerland and in emphasizing the role played by Switzerland in expanding the global use of the Chinese currency.

In June, the head of the department, Eveline Widmer-Schlumpf, and SNB President Thomas Jordan met with Zhou Xiaochuan, governor of the Chinese central bank, to discuss greater financial-sector cooperation.

Since 2009, as part of its effort to revamp the country's creaky financial system, the Chinese government has been pushing for a greater role for the yuan on the world stage. So far China's central bank has signed currency-swap agreements with more than 20 central banks, including the European Central Bank and those in the U.K. and Australia.

The swap deals are designed primarily to allow central banks to ease liquidity squeezes during periods of financial market tension, but will also boost two-way investment.

China is a key trade partner for the Alpine country, representing its biggest export market outside of Europe and North America. Last year, the countries signed a free-trade agreement, giving them improved access to each other's markets.

An additional benefit from the deal is that it will help the SNB to diversify its reserves of foreign currency, which have swelled to around 70% of annual economic output, compared with less than 10% before the financial crisis in 2008.

Write to Neil MacLucas at neil.maclucas@wsj.com

(END) Dow Jones Newswires

July 21, 2014 12:28 ET (16:28 GMT)

Copyright (c) 2014 Dow Jones & Company, Inc.