Well, yes, obviously
"Could an empire form primarily due to economic strength rather than primarily military strength?" Of course. Sure. Plain obvious. Because, you see, military strength requires economic strength. A country can only have a powerful army if it has a strong economy: because in the end soldiers are nobility, unproductive members of the society who must be supported by the productive civilians. Soldiers need to be paid, they need to be fed, they need to be clothed, they need shelter, they need fancy expensive equipment which is not really useful for anything much, and it is the rest of the society who must pay or provide for their pay, their food, their uniforms, their barracks and fortresses, their armor and weapons.
The best, strongest and richest economy of the Classical World was the Roman Empire; their economy was so strong that by the 1st century CE they could afford to maintain maybe 5% to 6% of their men in the army, which nobody else could. But then, by the 3rd century things started to go downhill, and when the Middle Ages came there was no king in Europe who could even dream of maintaining 1% of his men in the army. The best example I can think of is the Battle of Hastings, which is the medieval battle with the most far-reaching and world-changing consequences; in this pivotal battle, each of the two sides fielded maybe about 10,000 men, that is to say, about the strength of two Roman legions.
This is not say that each and every country with a strong economy will chose to also develop great military strength; other paths are available to ensure security, for example by finding and maintaining alliances with powerful allies. Modern Germany and Japan come to mind, countries with very strong economies which for quite some time have chosen to forego developing strong armed forces based on their relationship with the USA. (There are signs that this might changing. Both countries are increasing defence spending.)
Counterexamples?
But wait, an informed reader might say, aren't the Soviet Union and China counterexamples? Were they not poor countries who held the USA at bay and even defeated her in actual wars?
The Soviet Union was many things, some of them good, many of them bad, but it was definitely not poor. Yes, the average Soviet citizen had a standard of living much lower than the average Hollywood American citizen, but the country was enormously large, had endless natural reserves, and had a very strong industrial base.
OK, OK, the Soviet Union was not really poor. But the People's Republic was dirt poor, and yet she still defeated the Americans in the Korean War, didn't she? Not really. First, the outcome of the Korean War was basically the restoration of the status quo ante bellum; and, if we look closely, South Korea actually made some small territorial gains. Second, by and large the Korean War a successful defence of South Korea by United Nations (mostly American) forces. Third, the defence of South Korea was the objective of the USA in the war; they achieved their objective. What is important to note is that when the People's Republic did try an all out offensive into South Korea they were repulsed with catastrophic losses.
Enough theory, what about practice?
In practice, we have two examples of medieval (or at least medieval-ish) European powers holding an essential maritime waterway: Denmark¹, who held the Sound connecting the Baltic with the North Sea, and the (Eastern) Roman Empire who held the Bosporus and the Dardanelles connecting the Black Sea with the Mediterranean.
¹) Well, the political history of the Nordic Countries is complicated. The Sound Dues were introduced in 1429 by Eric of Pomerania, who was king of the Kalmar Union, which comprised what are today Denmark, Norway, Sweden and most of the inhabited part of Finland. But Sweden seceded in the second half of the 16th century, taking Finland with it; the united Danish-Norwegian kingdom endured until 1814.
Denmark successfully enforced passage tolls on ships transiting the straits between the North Sea and the Baltic. This made for a nice tidy stream of revenue from the 14th to the 19th century. But while the Sound Dues did contribute a considerable sum to the Danish Royal treasury, they did not make Denmark sufficiently rich to become a great military power.
The point being that taxing the passage through a strait is not a suitable economic base. Yes, it can pay for some nice buildings and maybe a great Academy and such; but it cannot pay for an army and fleet.
The (Eastern) Roman Empire held the Bosporus and the Dardanelles for hundreds and hundreds of years, from the late Antiquity to the end of the 13th century or thereabouts. They did get a certain amount of income from taxes on trade, but those were mostly import and export taxes. The incomed derived from transit taxes was never a significant contribution to the imperial treasury, because it was the Middle Ages.
Yes, Genoa did do some trade between the Mediterranean and the Black Sea, and yes, they did pay some small sums to the Empire. But it was the Middle Ages. Long distance trade was feeble, and a few percent of a feeble stream of trade is not something an empire can base its economy on.
The Middle Ages were medieval
When the question says that the story is set in a world "similar to Europe and the Mediterranean in the Middle Ages" the first thing which comes to my mind is that there is very little long distance trade. Because it's the Middle Ages, nobody has enough agricultural productivity to be exporting large amounts of food, nobody has enough industrial productivity to be exporting large amouts of manufactured goods, and nobody has any incentive to built large ships to carry the non-existent freight.
The second thing which comes to my mind is that there is basically no trade at all between the northern and the southern shores of the Mediterranean, because the Christians on the northern shores and the Muslims on the southern shores are almost always at war and they definitely don't do much commerce.