Earlier this week, Gordon Brown told the Leveson Inquiry that he believed the Tories supported Mr Murdoch's plans to re-shape British media, including a bid to take over BSkyB.
But, visibly rattled, David Cameron told Lord Justice Leveson: "There was no overt deal for support, there was no covert deal, there were no nods and winks."
After weeks of controversy surrounding Culture Secretary Jeremy Hunt's handling of the BSkyB bid, Mr Cameron went on to say: "There was a Conservative politician - me - trying to win over newspapers, trying to win over television, trying to win over proprietors, but not trading policies for that support."
Mr Cameron said the allegation was an "absolute nonsense from start to finish".
He accused Mr Brown of being angry about The Sun newspaper's desertion of him and of cooking up "a completely specious conspiracy theory".
The PM, who has submitted an 84-page witness statement and three exhibits to the inquiry, was questioned about wining and dining with Murdoch executives, such as former News International chief executive Rebekah Brooks.
In September 2009, The Sun newspaper, of which she was editor at the time, switched its support to the Conservative Party - and announced the move during Labour's autumn conference.
Asked by Inquiry counsel Robert Jay QC to pinpoint when Mrs Brooks became a close friend, the PM said the "relationship got stronger" when she married Charlie Brooks - a longstanding friend and neighbour of Mr Cameron's in the Cotswolds.
During her evidence to the inquiry in May, Mrs Brooks revealed Mr Cameron texted her regularly and often signed off his text messages to her with 'LOL', which he wrongly believed stood for 'lots of love'.
Earlier, he told the inquiry that he believed the relationship between politicians and the press had become too close.
Giving evidence at the probe into media ethics at the Royal Courts of Justice in London, he said: "In the last 20 years I think the relationship has not been right. I think it has become too close, and I think we need to try and get it on a better footing."
He said the growth of 24 hour news had changed the media industry and with it, the role of newspapers, making life more difficult for governments.
A culture of "too much spinning" combined with "daily news-fighting" were part of the problem, he said.
The Major government of the 90s was aware of the issue, and the pendulum swung too far under Labour in terms of controlling the news agenda, he said.
"We need the pendulum to swing back a bit while still being professional and able communicators because you have got to try and get your message across," he told the inquiry.
"There have been various attempts along the way to grab hold of the pendulum and do something about it.
"We are here because of the truly dreadful things that happened, not to politicians, but to ordinary members of the public whose lives have been turned upside down.
"This is a sort of cathartic moment where press, politicians, police - all the relationships that haven't been right - we have a chance to reset them."
He admitted that it was difficult for governments to reform the system because they had a vested interest.
"We need to try to find a way for some independence to be brought to that," he said.
"I think the regulatory system we have at the moment doesn't work. We need to draw some boundaries but it is very difficult to do.
"If you take the expenses scandal, it was deeply painful for politicians but it was absolutely right that it was revealed."
Mr Cameron said sometimes relationships were strong but "sometimes you struggle".
"Asking politicians whether they are happy with the way the media is reporting the news is a bit like asking farmers about the weather. We are always going to complain."
He is also likely to be quizzed about his controversial decision to recruit Andy Coulson, the former News Of The World editor, as No 10 communications director after he had resigned from the paper over the phone-hacking scandal.
Mr Cameron's long awaited appearance at Leveson comes after the Government defeated a Labour move in the Commons to refer Mr Hunt for investigation.
Labour wanted the PM's independent adviser on ministerial standards to probe Mr Hunt's handling of News Corporation's bid for BSkyB.
The Government's victory came after Mr Cameron told MPs that his adviser, Sir Alex Allan, had written to him to say that he could not "usefully add to the facts" in the Hunt case uncovered by the Leveson Inquiry into media standards.
Labour dismissed Mr Cameron's comments as an ineffective "smokescreen" and said that the Prime Minister's judgment in appointing Mr Hunt to a quasi-judicial role in the BSkyB bid was in question.
He has also been forced to confess that he rode her horse Raisa with Mrs Brooks' husband Charlie, which was lent to her by the Metropolitan Police between 2008 and 2010, and that he went to her house in the Cotswolds for Christmas dinner.
The Prime Minister's allies claim he wants to put the record straight, as he sees it, over the decision not to subject his former spin doctor Mr Coulson to "developed vetting" (DV) - the higher form of security clearance - after he entered Downing Street following the general election.
He has said the reason why Mr Coulson was not subject to DV was that Sir Jeremy Heywood, the No 10 permanent secretary in 2010, wanted to restrict the access of politically-appointed special advisers handling communications to sensitive material.
But Mr Heywood changed this after a terror alert at East Midlands airport in October 2010.