Carwyn Jones and Nigel Farage have disputed the likely impact on jobs in Wales if the UK left the EU.
In a head-to-head debate in Cardiff, the first minister warned an EU exit would have "devastating consequences".
The UKIP leader claimed being in the EU had left the first minister "impotent" over the fate of the steel industry.
Mr Farage said British people should "reclaim their birthright" while Mr Jones said Wales and the UK should not "surrender" their role in the world.
In an event staged by the Institute of Welsh Affairs, the UKIP leader began by asking if British people wanted to "regain our independence as a nation state" or if they were happy to be a "subordinate member of the club".
Mr Farage claimed it was "scaremongering" to say trade would cease and jobs would be lost following a British exit from the EU.
The first minister replied by saying membership of both unions - the UK and the EU - was vital to Welsh prosperity.
Claiming 200,000 jobs in Wales relied on EU trade, Mr Jones said "pulling up the drawbridge" would have "devastating consequences".
On the issue of immigration, Mr Farage said "the biggest benefit" of leaving the EU would be the UK's ability to set up an Australian-style points system to accept people based on their skills, lack of criminal convictions and ability to speak English and integrate.
However, Mr Jones dismissed the suggestion EU membership had "anything to do" with immigration, saying if the UK was not a member, France would simply allow refugees camped at Calais to pass through.
"Would it be in our interest to turn our backs on our European partners, or isn't it better to work together to find a European solution to what is a European challenge," he asked.
Eluned Parrott, Welsh Liberal Democrat spokesperson on Europe, said "neither person came out of this shouting match particularly well", claiming hers was the only UK party united in favour of EU membership.
"Carwyn Jones was right to be arguing the importance of the UK remaining in the EU," she said.
"Yet, his views are in stark contrast to his party in London, where [Labour leader] Jeremy Corbyn remains ambivalent on this major issue."
Plaid Cymru AM Elin Jones was critical of Mr Jones, tweeting: "Well, for the case for Wales staying in EU, that was a set-back. Mustn't be repeated. #IWADebate."
Before the event, a spokesman for the Welsh Conservatives dismissed it as having the feel of a "rather gaudy PR spectacle", saying Mr Jones had failed to invite rival party leaders to debate Welsh issues under his control.
A referendum on whether the UK should remain within the EU or leave is set to be held before the end of 2017.
On Sunday, Prime Minister David Cameron suggested the vote could be held as early as this summer.