'We have only one Bach, whose manner is entirely original and peculiar to him alone.' To us this could only mean Johann Sebastian. But not in 1774, when the composer JF Reichardt penned these words. A quarter of a century after his death, Johann Sebastian's music, while not quite forgotten, seemed marginal or irrelevant. And except perhaps in England, where Sebastian's youngest son, Johann Christian, held sway, the 'great Bach' invariably denoted J.S.'s second son Carl Philipp Emanuel, revered by Haydn and Mozart and widely acknowledged as one of the supreme composers of the age.

In his lifetime Emanuel Bach presented something of a contradictory figure: harpsichordist to Frederick the Great who was perfectly capable of turning out blandly elegant pieces in the galant style yet in the works written for his own pleasure quickly acquired a reputation for 'bizarrerie'; an intellectual and pedagogue of the Age of Reason who became famous for his rapt and romantic clavichord improvisations; and, later in life, Kantor in Hamburg who produced ephemeral odes and cantatas to order while allowing his genius free rein in some of the most original symphonies and keyboard works of the eighteenth century.

Emanuel Bach's most personal music represents the pinnacle of Empfindsamkeit, the cult of 'heightened sensibility' practised by a group of North German composers in reaction to the 'rational' strain in Enlightenment thinking. This celebration of pure feeling was related to a whole aesthetic movement whose literary manifestations included the novels and writings of Samuel Richardson and Laurence Sterne, Jean-Jacques Rousseau's La nouvelle Heloise (first e acute, two dots on i) and, most famously of all, the young Goethe's semi-autobiographical portrayal of thwarted passion and suicide, The Sorrows of Young Werther.

The credo of Empfindsamkeit was that music should 'touch the heart' and 'awaken the passions'. In contrast to the perceived severity and complexity of the outmoded baroque style, the emphasis was now on individual self-expression. In lesser hands Empfindsamkeit could be synonymous with cloying sentimentality. But in Emanuel Bach's finest sonatas and orchestral works halting phrases and sighing suspensions combine with a still astounding harmonic boldness to produce music unlike anything else written in the eighteenth century.

Bach, like most composers of his generation, had limited use for baroque counterpoint. But throughout his life he could draw on it to enrich and strengthen his music. And as you would expect, he perfected his contrapuntal technique through study with Johann Sebastian, of whom he wrote in his autobiography: 'My only teacher was my father.' Born in Weimar on 8 March 1714, Emanuel grew up in the musically rich atmosphere of Leipzig, where, as he noted, 'I had from an early age the special good fortune of hearing the most excellent music of all kinds all around me.' Being left-handed, he was excused from studying string technique. But he quickly excelled on the harpsichord; and by the age of eleven he could apparently play any of his father's keyboard pieces at sight.

Like Handel before him, Emanuel initially studied law, first at Leipzig University and then, from 1734, in Frankfurt an der Oder. The decisive moment came after he graduated in 1738 and received 'an unexpected and gracious summons...from the then crown prince of Prussia'. The crown prince in question was the future Frederick the Great, who juggled his expansionist military adventures with the gentler pursuits of philosophy and music. Bach was to remain in his service for thirty years.

As harpsichordist at Frederick's court, first at Ruppin and Rheinsberg, then in Berlin, Bach was some way down the musical pecking order. The most privileged court musicians were Carl Heinrich Graun and, especially, Johann Joachim Quantz, Frederick's flute teacher and purveyor of concertos by the yard for the king's delectation. Quantz was not only paid far more than the young harpischordist-composer (2000 thalers in 1744-5 against Bach's 300), but also enjoyed unique powers in the court. Bach, an altogether less compliant personality, came increasingly to resent not only his inferior financial status but also the atmosphere of sycophancy that pervaded the court. Frederick's flute playing was tolerable, but nowhere near as good as the flatterers pretended. And when one courtier gushed 'What rhythm!' during a royal performance, Bach was heard to mutter caustically, 'What rhythms.'

In his Berlin years Bach wrote a fair amount of dispensable 'utility' music, including easy keyboard pieces and works for the king's own performance. But in his first major keyboard publications, the 'Prussian' Sonatas of 1742 and the 'Wurttemberg' (u umlaut) set of 1744, the lingering influence of his father (several movements open just like a J. S. two-part invention) coexists with his own brand of sensibility: these sonatas repeatedly undermine the smooth euphony of the galant style with harmonic shocks and strange and sudden discontinuities of rhythm and texture. The rhetoric of these works is often startlingly intense, especially in the richly embellished slow movements. And while Bach's designs often suggest the classical 'sonata form' in miniature, with variation and development of motifs a la Haydn, the details frequently have an improvisatory waywardness.

Most of Bach's solo keyboard music from his Berlin years was conceived for the clavichord, a delicate, essentially private instrument that crucially influenced the composer's subjective musical language. He expounded his aesthetic and keyboard method in his famous Essay on the True Art of Playing Keyboard Instruments, which was hugely influential in the eighteenth century and is still studied today. To accompany the Essay he wrote a heterogeneous set of sonatas and sonatinas (Wq 63) which range from innocuous galanterie to some of his most prophetic and visionary music. Most visionary of all is the finale of the F minor sonata, No. 6, a violent, impassioned fantasia whose melodies seem to evoke heightened speech, their changes of pace and dramatic hesitations imitating an actor's rhetorical emphases.

In contrast to this essentially private music are the bold, fiery symphonies and harpsichord concertos (some of them later arranged for flute and/or cello) that Bach composed for the Berlin court and concert hall. Together with the mellifluous concertos of his half-brother, Johann Christian, Emanuel's harpsichord concertos form a crucial link between the baroque ritornello design of Vivaldi and the classical concerto of Mozart. But to regard them as merely 'transitional' is to miss their brilliance and originality. Even when Bach seems at his most compliantly galant he is always likely to pull the rug from under your feet with a startling hiatus or harmonic twist. And his most characteristic Allegros - as in the D minor concerto, Wq 23 - have a thrilling nervous vitality that prefigures the so-called Sturm und Drang ('Storm and Stress') movement of the late 1760s and 1770s. Equally prophetic of Sturm und Drang is the troubled, turbulent E minor symphony (Wq 177) of 1756 - the kind of work that frightened and repelled the groundlings but 'drove connoisseurs to frenzy'.

Bach's only choral composition from his Berlin years, the Magnificat of 1749, is probably his most familiar work today. It is also his most eclectic. In one sense it stands as a homage to his father's own Magnificat: in the rushing D major scales of the opening, for instance, or the near-verbatim quotations in the 'Fecit potentiam' and 'Deposuit'. The majestic final fugue, too, proclaims Emanuel Bach's mastery of the contrapuntal craft he had honed with his father. But elsewhere the idiom is far more up-to-date, with movements in the fashionable Neapolitan style and others, like the aria 'Suscepit Israel', in Bach's tenderest, most empfindsam vein.

In time Emanuel Bach became increasingly disenchanted with his underpaid job at the Prussian court. His was never a courtier's nature; and to the end Frederick cared only for his harpsichordist's most innocuous music. The final straw came when the king refused to compensate his musicians for the losses they had suffered during the Seven Years' War (1756-63). One escape route opened up in 1767, with the death of his godfather Telemann in Hamburg. The following year Bach succeeded him as Kantor of the Latin School and music director of the city's five main churches, with duties similar to those of his father in Leipzig. Unlike Johann Sebastian, though, Emanuel was spared class teaching; and his official duties left him plenty of time to relish the cultivated, informal atmosphere of the prosperous Hanseatic city-state.

The Passions, cantatas and cermonial odes Bach turned out to order in Hamburg are often bland and pallid. But there are a handful of exceptions, music written out of impulse rather than duty. The earliest of these is the 'sacred poem for singing' Die Israeliten in der Wuste (u umlaut) - 'The Israelites in the Desert' (1769), a reflective rather than dramatic work which reconciles a graceful, popular tone with subjective intimacy. Even finer is is the Resurrection cantata of 1777-8, Die Auferstehung und Himmelfahrt Jesu. Again, it's a work of meditation rather than action, though there's a splendid thundering bass aria, an accompanied recitative with a spectacular part for timpani, and a thrilling final chorus that ends with a kind of celestial jig. But the greatest of Bach's choral works is the monumental Heilig (Sanctus) for double choir and orchestra (1778). The antiphonal choral exchanges, poetically juxtaposing distant keys, culminate in a thrilling syncopated fugue that incorporates the Lutheran Te Deum hymn - another tribute to the art of Johann Sebastian.

Away from his liturgical duties, Bach was soon mounting his own concerts in Hamburg to promote himself in the dual roles of composer and performer. For these concerts he wrote a new set of harpsichord concertos in 1771 (Wq 43), more 'modern' in their orchestral garb (with flutes and horns) and superficially more elegant in manner than his Berlin concertos, but full of his trademark boldness and fire. Even more wilful are the two sets of symphonies Bach wrote in Hamburg: the six for string orchestra commissioned by Gottfried van Swieten in 1773 (Wq 182), and the four for strings plus wind of 1776 (Wq 183). Swieten stipulated that Bach should 'give himself free rein, without regard to the difficulties of execution'. And in both sets of symphonies Empfindsamkeit confronts the violence of Sturm und Drang. In their first movements, particularly, Bach seems more than ever intent on subverting norms of harmony, rhythm, phrase-length and dynamics. Paradox is the order of the day, with every promise of solidity or galant euphony disrupted by a tactless outburst or a swerve to an alien chord. There is humour here, though it tends to be odder and more disquieting than Haydn's. The opening of the D major symphony Wq 183/1, for instance, is both zany and unnerving, with no theme to speak of, no stable key and no fixed pulse. Yet this is fascinating and exciting music; and while Bach does not explore the implications of his eccentricities as rigorously as Haydn, the opening bars create further dramatic consequences later in the movement.

The English music historian Charles Burney, who visted Bach in Hamburg in 1772, left a famous description of the composer at the clavichord: 'He grew so animated and possessed (itals), that he not only played, but looked like one inspired. His eyes were fixed, his under lip fell, and drops of effervescence distilled from his countenance....' The caprice and soulfulness of Bach's playing style is reflected in many of the sonatas, rondos and fantasias in the six collections 'for connoisseurs and amateurs' published between 1779 and 1787. The sonatas are endlessly unpredictable in their forms and expressive range; and several, including the F major, Wq. 55/5, disorient the listener from the outset by beginning in the 'wrong' key. The rondos take their usually innocent themes as a cue for the most outrageous harmonic adventures. And the fantasias sound like inspired improvisations, by turns wildly passionate and broodingly inward. Most inward of all is the 'Freie Fantasie' in F sharp minor, Wq 67, marked 'very sorrowful and utterly slow': an old man exploring his instrument's capacity for pathos to the very limit.

This deeply moving fantasia was his solo swansong. But his last major work of all, the double concerto for the old-meets-new pairing of harpsichord and fortepiano, is a very different affair, written with a septuagenarian's nonchalant mastery. The spirit is more genial than in C.P.E.'s earlier concertos. But the music still has much of Bach's old fiery unpredictability, culminating in a madcap finale that suggests Haydn at his craziest.

After Emanuel Bach's death on 14 December 1788, his reputation was kept alive more through his treatise on keyboard playing than through his music. By the early nineteenth century he had been downgraded to a mere precursor. Today we are beginning to judge Bach's uneven but often astonishing music on its own, rather than Haydn's or Mozart's, terms, and to hear it again as it was heard by the enlightened audiences of his own age: as the work of a true original whose bold, restless imagination reacted against the insipidity of the style galant, opted for risk rather than routine, and produced works at once 'fantastical and far-fetched' and propelled by their own powerful inner logic.