The work's early history is obscure, though there are some clues as to where it may have been first performed.
It is listed in a catalogue of the library at Nonsuch Palace, a royal palace sold in the 1550s to the Earl of Arundel before returning to the crown in the 1590s.
The listing, from 1596, describes it as "a song of fortie partes, made by Mr. Tallys".
The earliest surviving manuscripts are those prepared in 1610 for the investiture as Prince of Wales of Henry Frederick, the son of James I.
A 1611 commonplace book by the law student Thomas Wateridge contains the following anecdote:
In Queen Elizabeths time yᵉʳᵉ was à songe sen[t] into England in 30 p[art]s (whence yᵉ Italians obteyned yᵉ name to be called yᵉ Apices of yᵉ world) wᶜʰ beeinge Songe mad[e] a heavenly Harmony.
The Duke of — bearinge à great love to Musicke asked whether none of our English men could sett as good à songe, and Tallice beeinge very skilfull was felt to try whether he would undertake yᵉ matter, wᶜʰ he did & made one of 40 p[ar]tes wᶜʰ was songe in the longe gallery at Arundell house, wᶜʰ so farre surpassed yᵉ other that the Duke, hearinge yᵗ songe, tooke his chayne of Gold fro[m] his necke & putt yt about Tallice his necke & gave yt him (wᶜʰ songe was againe songe at yᵉ Princes coronation).

Supposing the "30" to be a mistake, the Italian song referred to has been argued to be either the 40-part motet Ecce beatam lucem or the 40–60-voice mass Missa sopra Ecco sì beato giorno, both by Alessandro Striggio, who is known to have visited London in June 1567 after a trip through Europe during which he arranged other performances of Missa sopra Ecco sì beato giorno.
This account is consistent with the catalogue entry at Nonsuch Palace: Arundel House was the London home of Henry FitzAlan, 19th Earl of Arundel; Nonsuch Palace was his country residence.
Nonsuch had an octagonal banqueting hall, which in turn had four first-floor balconies; on this supposition it could have been the case that Tallis designed the music to be sung not only in the round, but with four of the eight five-part choirs singing from the balconies.

Likewise, the only dukedom extant during Elizabeth I's reign was that of Norfolk, so the duke in the letter can only be Thomas Howard, 4th Duke of Norfolk, and so (if the anecdote is trustworthy) his execution in 1572 gives a latest date for the work's composition.
Some scholars consider that the Duke of Norfolk commissioned Tallis to write "Spem in alium" for performance at Nonsuch, and that its first performance took place there.
Other historians, doubting the anecdote, suggest that the first performance was on the occasion of Elizabeth's 40th birthday in 1573.

The above are the most widely held views, but both have difficulties.
The text comes from a response in the Matins order in the Sarum rite, which had been superseded by the Book of Common Prayer.
Indeed, the text used for a 1610 performance of the work, while set to the music, is entirely different, suggesting that the original text was not satisfactory.
Wateridge's letter is dated 40 years after the Elizabethan date and does not mention either Striggio or the Duke by name.
It has been suggested that if the duke in question was a Duke of Norfolk this could be the Third Duke, who was alive during Mary's reign.
Nonsuch Palace belonged to the Norfolks in the 1550s, having been sold to them by Mary.
As for the original text, its context of Judith slaying Holofernes and regaining her position fits with Mary's execution of the Duke of Northumberland, who had attempted to supplant her on the throne with Lady Jane Grey, rather than Tallis using it for Elizabeth.
The music itself is entirely different from Striggio's setting.
His work was for ten four-part choirs; Tallis's is for eight five-part choirs.
The '30' in Wateridge's letter may not be a misprint or an error; the work referred to may be simply unknown.
On these arguments Tallis wrote the work for Mary Tudor, Elizabeth's predecessor.
The possibility has been advanced that Striggio copied Tallis, though of this there is no evid
The work's early history is obscure, though there are some clues as to where it may have been first performed. It is listed in a catalogue of the library at Nonsuch Palace, a royal palace sold in the 1550s to the Earl of Arundel before returning to the crown in the 1590s. The listing, from 1596, describes it as "a song of fortie partes, made by Mr. Tallys". The earliest surviving manuscripts are those prepared in 1610 for the investiture as Prince of Wales of Henry Frederick, the son of James I.
A 1611 commonplace book by the law student Thomas Wateridge contains the following anecdote:
In Queen Elizabeths time yᵉʳᵉ was à songe sen[t] into England in 30 p[art]s (whence yᵉ Italians obteyned yᵉ name to be called yᵉ Apices of yᵉ world) wᶜʰ beeinge Songe mad[e] a heavenly Harmony. The Duke of — bearinge à great love to Musicke asked whether none of our English men could sett as good à songe, and Tallice beeinge very skilfull was felt to try whether he would undertake yᵉ matter, wᶜʰ he did & made one of 40 p[ar]tes wᶜʰ was songe in the longe gallery at Arundell house, wᶜʰ so farre surpassed yᵉ other that the Duke, hearinge yᵗ songe, tooke his chayne of Gold fro[m] his necke & putt yt about Tallice his necke & gave yt him (wᶜʰ songe was againe songe at yᵉ Princes coronation).
Supposing the "30" to be a mistake, the Italian song referred to has been argued to be either the 40-part motet Ecce beatam lucem or the 40–60-voice mass Missa sopra Ecco sì beato giorno, both by Alessandro Striggio, who is known to have visited London in June 1567 after a trip through Europe during which he arranged other performances of Missa sopra Ecco sì beato giorno. This account is consistent with the catalogue entry at Nonsuch Palace: Arundel House was the London home of Henry FitzAlan, 19th Earl of Arundel; Nonsuch Palace was his country residence. Nonsuch had an octagonal banqueting hall, which in turn had four first-floor balconies; on this supposition it could have been the case that Tallis designed the music to be sung not only in the round, but with four of the eight five-part choirs singing from the balconies.
Likewise, the only dukedom extant during Elizabeth I's reign was that of Norfolk, so the duke in the letter can only be Thomas Howard, 4th Duke of Norfolk, and so (if the anecdote is trustworthy) his execution in 1572 gives a latest date for the work's composition. Some scholars consider that the Duke of Norfolk commissioned Tallis to write "Spem in alium" for performance at Nonsuch, and that its first performance took place there. Other historians, doubting the anecdote, suggest that the first performance was on the occasion of Elizabeth's 40th birthday in 1573. 
The above are the most widely held views, but both have difficulties. The text comes from a response in the Matins order in the Sarum rite, which had been superseded by the Book of Common Prayer. Indeed, the text used for a 1610 performance of the work, while set to the music, is entirely different, suggesting that the original text was not satisfactory. Wateridge's letter is dated 40 years after the Elizabethan date and does not mention either Striggio or the Duke by name. It has been suggested that if the duke in question was a Duke of Norfolk this could be the Third Duke, who was alive during Mary's reign. Nonsuch Palace belonged to the Norfolks in the 1550s, having been sold to them by Mary. As for the original text, its context of Judith slaying Holofernes and regaining her position fits with Mary's execution of the Duke of Northumberland, who had attempted to supplant her on the throne with Lady Jane Grey, rather than Tallis using it for Elizabeth. The music itself is entirely different from Striggio's setting. His work was for ten four-part choirs; Tallis's is for eight five-part choirs. The '30' in Wateridge's letter may not be a misprint or an error; the work referred to may be simply unknown. On these arguments Tallis wrote the work for Mary Tudor, Elizabeth's predecessor. The possibility has been advanced that Striggio copied Tallis, though of this there is no evid
Spem in alium