Prime minister strongly attacks companies that avoid paying fair share of tax as he lays out trade-focused agenda for G8 summit

David Cameron has said trade, tax and transparency will be the three themes of Britain's presidency of the G8 this year.

Speaking at the World Economic Forum in Davos, the prime minister strongly attacked companies that avoid paying their fair share of tax and which indulge in corrupt business practices in poor countries.

Cameron said aggressive tax avoidance meant fewer resources for public services and delivered a sideswipe at the coffee giant Starbucks, which has been under attack since revealing it pays little corporation tax in the UK.

"Companies need to wake up and smell the coffee, because the customers who buy from them have had enough," the prime minister said.

Cameron used his speech to lay out his agenda for the G8 summit, which will be held in Northern Ireland in June. The leading western nations needed to work together to tackle the threat of extremism and terrorist violence, he said.

Following last week's attack in Algeria, Cameron said: "We are in the midst of a long struggle against murderous terrorists and the poisonous ideology that supports them."

Winning the battle would require the leaders of the developed world to be "tough, intelligent and patient". Military action would sometimes be needed, but the west also had to deal with the underlying grievances that caused terrorism, he said.

Britain last held the G8 in 2005, when Tony Blair put aid, trade and debt relief high on the agenda at the Gleneagles summit.

Cameron said there was still unfinished business on trade and called for the completion of a free trade deal between the European Union and the US which he said could add £50bn to Europe's economy.

Seeking to reassure the business leaders gathered in Davos that his focus on tax did not mean he was anti-capitalist, he said: "I'm as pro-business a leader as you can find." But he said it was not just NGOs that had been lobbying him on the issue, but the upper echelons of the City as well.

"It's a world where some companies navigate their way around legitimate tax systems – and even low tax rates – with an army of clever accountants. We can be the generation that eradicates extreme poverty in our world, but we need to tackle the causes, not just the symptoms. We need to lay down the rules of the game, and we need to be prepared to enforce them. Proper companies, proper taxes, proper rules."

Cameron said he was proud that Britain was living up to its pledge to spend 0.7% of national income on development assistance, but that greater transparency was needed to make sure the aid was well spent.

The prime minister said: "Corrupt government officials in some countries and some corporations run rings around the letter and spirit of the law to rip off hard-working people and plunder their natural resources.

"There's a long and tragic history of some African countries being stripped of their minerals behind a veil of secrecy.

"We can see the results: the government cronies get rich – some beyond their wildest dreams of avarice – while the people stay poor."

Cameron said that unleashing the natural resources from developing countries would dwarf anything aid could do – and transparency was vital to that.

Pledging to shine a light on the issue, the prime minister added: "So we're going to push for more transparency on who owns companies, on who's buying up land and for what purpose, on how governments spend their money, on how gas, oil and mining companies operate, on who is hiding stolen assets and how we recover and return them."

Jasmine Whitbread, chief executive of Save the Children International, said: "I would like people going away from Davos to remember as much about this Cameron speech as his speech [on Europe] yesterday."