The oldest active treaty is the Anglo-Portuguese Treaty of 1373, which promises "perpetual friendship" between England (and later the United Kingdom) and Portugal, signed by King Edward III of England and King Ferdinand and Queen Eleanor of Portugal. The treaty itself was the first official documentation of a friendly relationship that dates to 1147, when the English helped Alfonso I retake Lisbon from the Moors while en route to the Holy Land during the Second Crusade. It was reinforced by the Treaty of Windsor in 1386, which constituted a pact of mutual aid that was sealed by the marriage between John I of Portugal and Philippa of Lancaster (Edward III's granddaughter).
The alliance established by the treaty of 1373 is the oldest still active alliance in the world. The pact of mutual aid has been activated many times in the centuries since. Most notably, Britain came to the aid of Portugal against a Franco-Spanish invasion in 1762 during the Seven Years War and again against the French during the Napoleonic Wars (an invasion that occurred because Portugal, alone of all the nations of continental Europe, refused to cease trading with Britain, in defiance of Napoleon's Continental System). This actually constituted Britain's largest terrestrial commitment for the duration of the conflict.
Portuguese troops fought alongside the Allies on the Western Front in WW1. Interestingly, in WWII Britain negotiated with Portugal not to activate the alliance. For Britain, Portuguese neutrality was essential in helping to keep Spain from joining the Axis powers. The official statement of the Portuguese government was that the alliance was intact but Britain had chosen not to activate the pact of mutual aid. This changed in 1943, when Britain activated the alliance and Portugal granted the Allies use of several naval bases, notably in the Azores islands, in Portuguese territory.