"The U.S. government strongly believes in Nigeria having credible, free and fair elections next month," Kerry said at the U.S. Consulate in Lagos following separately meetings with Nigerian opposition leaders and President Goodluck Jonathan.
"We want to say that any Nigerian who promotes any form of violence during the elections remains ineligible for U.S. visa," he threatened.
Millions of Nigerians will go to the polls on Feb. 14 to elect a new president and parliament.
Kerry met earlier with leaders of the opposition All Progressive Congress (APC) in commercial capital city Lagos.
The meeting was attended by Muhanmadu Buhari, a former military ruler contesting the presidential race against Jonathan on the APC's ticket, the party's chairman John Oyegun and powerful former governor of Lagos Bola Tinubu, among other key leaders.
Washington's top diplomat later met President Jonathan.
He said U.S. President Barack Obama had asked him to tell Nigerian political figures that America is "ready to engage and support Nigeria but the democratic process must be credible."
President Jonathan, for his part, emphasized commitment to free, fair and credible elections.
"I made it absolutely clear that the May 29th handover date is sacrosanct," he said in a statement released by the State House.
Jonathan pledged that the government will provide all resources that are required by the Independent National Electoral Commission to ensure that the election goes smoothly.
"I also emphasized that INEC is an independent body, which makes its own decisions without any interference from the government," he added.
Jonathan's National Security Adviser Sambo Dasuki stirred controversy last week after telling an audience at the Chatham House think-tank in London that he had asked the electoral commission to delay the polls.
The Nigerian opposition immediately rejected the proposal and dismissed it as "ill-advised" plot by the ruling party and the government to cling to power.
Secretary Kerry also reaffirmed support for Nigeria as the country continues to battle a deadly Boko insurgency.
"The U.S. will continue to work with the Nigerian military in putting an end to the continuous killings of innocent Nigerians and attack on communities," he said.
"The U.S strongly condemns these attacks which have escalated in the last few weeks and it is gradually spreading to neighboring countries," added Kerry.
Kerry's visit coincided with daring attacks by hundreds of Boko Haram militants on Maiduguri, the provincial capital of Borno State, and Monguno.
Although the attack was repelled, the insurgents have seized Monguno in what local vigilantes said sealed their capture of the entire northern third of Borno.
President Jonathan, for his part, reaffirmed to Kerry Nigeria's strong commitment to building the multinational task force to fight Boko Haram in partnership with Cameroon, Chad, Niger and Benin.
"Indeed, I called publicly for such a regional approach at the African leaders' summit in Paris in May 2014 and more recently in multilateral meetings," he said.
"Winning the fight against Boko Haram in Nigeria and West Africa is absolutely essential to beat back the tide of religious extremism around the world," added the Nigerian leader.
He asserted that the U.S. has the most experience fighting armed insurgencies.
"This is why I firmly believe that enhancing and expanding various channels of cooperation between our two countries, in the context of growing international coordination, are of the utmost importance," said Jonathan.
For the last five years, Nigeria has battled a fierce Boko Haram insurgency that has ravaged the country's volatile northeast and claimed thousands of lives.
The year 2014 proved to be the insurgency's bloodiest year yet, with increasingly frequent attacks, higher death tolls and a deluge of displaced persons.
A seemingly emboldened Boko Haram recently stepped up its militant activity, seizing several areas of Adamawa, Yobe and Borno states