Shelvey is now set to discuss personal terms with the Welsh club and undergo a medical.
The England international - he has won one cap as a substitute in the 5-0 win over San Marino at Wembley last October - had also attracted the interest of Premier League newcomers Crystal Palace, but their bid was reportedly £1m less than Swansea's.
Shelvey started his career with Charlton before moving to Liverpool for £1.7m in May 2010.
He has since made 69 appearances for the Reds and scored seven goals but has now been deemed surplus to requirements by boss Brendan Rodgers.
Swansea chairman Huw Jenkins has spoken of the need to increase the quota of homegrown players at the Liberty Stadium and Shelvey fits the bill.
"We have got to make sure that the make-up of our squad is right," said Jenkins.
"And obviously part of that is making sure that we have so many British players in there. We have got to do that - there is no choice because they are the rules."