British Prime Minister Boris Johnson said the UK would "provide support" if Sweden were to be attacked, reported DW, quoting news agencies AFP and Reuters.
The agreement comes as Sweden and Finland are set to decide whether to join NATO.
After meeting at the Swedish prime minister Magdalena Andersson's retreat in Harpsund on Wednesday, the Premiers announced a mutual defense agreement in case of an attack.
"If Sweden were attacked and looked to us for support then we would provide it," Johnson told reporters at a joint press conference.
Under the agreement "if either country should suffer a disaster or an attack, the UK and Sweden will assist each other in a variety of ways… and may include military resources," said Prime Minister Andersson.
In a statement, the British government said that the new agreement aims to intensify intelligence sharing and accelerate joint military training, exercises and deployments.
Johnson did not specify whether the UK would send troops to Sweden in the event of an attack.
"It is up to Sweden to make the request and to spell out exactly what support is requested," he said.
NATO decision expected soon
The announcement comes as Sweden and neighboring Finland are expected in the coming days to decide whether to join NATO, as Russia's war in Ukraine has prompted both countries to rethink their security strategies.
Johnson added that the UK would support whatever direction Sweden decides to take on NATO membership.
"We'll be as useful and supportive as we can," Johnson said.
During a joint press conference later Wednesday after a meeting Finnish President Sauli Niinistö in Helsinki, Johnson said NATO is a "defensive alliance" that "does not pose a threat to anyone."
"It is there for the purposes of mutual defense," the British prime minister said.
Why is a defense deal desired?
Johnson is set to ink a similar defense deal with Finland while in Helsinki, his office said.
However, processing the application could take up to a year, and both are seeking security assurances in the interim as Moscow staunchly opposes any expansion of the security alliance.
The United States and Germany have also promised to support Sweden and Finland in whatever decision they reach.
For decades, Sweden and Finland have pursued a policy of lower-level defense agreements, rather than taking the step of joining NATO. Both remained neutral during the Cold War.
The UK, Sweden and Finland are already part of the Joint Expeditionary Force, a multinational military group focused on security in the Nordic region, the North Atlantic and Baltic Sea.
However, Russia's invasion of Ukraine has changed the calculus in Stockholm and Helsinki that bilateral agreements are no substitute for Article 5 of NATO's charter, which states that an attack on one member state would be considered an attack on all.