Quba is a city and the administrative centre of the Quba District of Azerbaijan. The city lies on the north-eastern slopes of Shahdag mountain, at an altitude of 600 metres above sea level, on the right bank of the Kudyal river. It has a population of 38,100 (2010).

Quba was mentioned in works of various European geographers, in ancient Arabic and Albanian sources. The castle built by the ruler Anushiravan in the 11th century was called 'Bade-Firuz Qubat', and in the Arabic sources of the XII century Quba was mentioned as 'Cuba'. In the 13th century, in the Dictionary of Geographical names of Arabian scientist Hamabi it was mentioned among the Azerbaijani cities as Kubba, and in the sources of 16th century Quba was referred to as 'Dome'.


Guba (Quba) city originated from the riverside village of Gudial. In the mid-18th century, after moving his residence from Khudat, Hussain Ali became Quba's Khan (tribal Turkic Muslim ruler) and raised fortress walls around the city. He thereafter attempted to create a state separate from other Azerbaijani khanates. The position of the Quba khanate grew stronger during the reign of Fatali Khan (1758–1789), son of Hussain Ali Khan.
Nevertheless, Quba Khanate, like other Transcaucasian khanates, was occupied by Czarist Russia in the early 19th century and formally annexed to the Russian Empire under the agreement of 1813. After the rehabilitation Quba was included in the Derbent province in 1840 and then in the Baku province in 1860.


Alexandre Dumas, Russian orientalist Berezin, the writer Bestuzhev-Marlinsky, the Norwegian scholar and adventurer Thor Heyerdahl visited Quba at the time.
Quba is also a center of carpet weaving industry. There is located a carpet making company called 'Qadim Quba'. The carpet 'Golu Chichi' woven here in 1712 is now exhibited in the Metropolitan Museum in New York.
The majority of the population is Azerbaijanis, while Tats and Lezgians constitute other minorities. The city's suburb of Qırmızı Qəsəbə (formerly in Russian: Красная Слобода, Krasnaya Sloboda; literally 'Red Town') is home to the country's largest community of Mountain Jews and one of the largest Jewish populations in the former Soviet Union.