Net profit for the period was up 14 percent at 1.17 billion Swiss francs (1.03 billion euros, $1.21 billion).
The result was better than expected by analysts interviewed by Swiss agency AWP who predicted profits of 938 million Swiss francs .
Operating income came in as forecast at 7.2 billion.
The group said it is on track to reach its cost-savings target of 2.1 billion Swiss francs by the end of 2017.
"Considering market conditions, the second quarter results were very good and contributed to a strong first half of the year," said chief executive Sergio Ermotti.
"Our global wealth management business in particular delivered an excellent performance. The results once again demonstrate the value of our diversified business model, allowing us to grow profitably and sustainably over the cycle and in a variety of market conditions."
"Improved investor sentiment and enhanced confidence have translated into improvements in wealth management client activity levels," UBS said in a statement.
The group said it expected the global economic recovery to strengthen, but "geopolitical tensions and macroeconomic uncertainty still pose risks to client sentiment."
"Low and negative interest rates, particularly in Switzerland and the eurozone, put pressure on net interest margins, which may be partially offset by the effect of a further normalisation of US monetary policy."