Brazilian architect Oscar Niemeyer attends an event marking his 100th birthday, in Rio de Janeiro. AP

Oscar Niemeyer, the Brazilian architect who designed the United Nations building and his country's futuristic capital of Brasília, died on Wednesday in a hospital in Rio de Janeiro. He was 104.

Mr. Niemeyer became one of the 20th century's most important architects by infusing modernism with the tropical sensibilities of his native Brazil. He also attracted fierce critics—including many people who worked in his Brazilian buildings and found them unsuitably hot for the climate.

Brazilian architect Oscar Niemeyer is kissed by great-great grandson Ivan, as great-great granddaughter Maite looks on during his 104th birthday celebration on Dec. 15, 2011, in Rio de Janeiro. AFP/Getty Images

Mr. Niemeyer was also regarded as a visionary for adding reinforced-concrete curves to the right angles of formal modernism. In 1988, he won architecture's top honor, the Pritzker Architecture Prize.

"Few dreamed so intensely and made so many things happen as he did," President Dilma Rousseff said. "Niemeyer was a revolutionary, a mentor of a new architecture, pretty, logical and, as he himself defined it, inventive."

He will be best remembered as the chief architect of buildings in Brazil's futuristic capital, Brasília, built from scratch in the country's uninhabited interior plains in the late 1950s. An airy cathedral resembling an upturned shuttlecock and a National Congress building seemingly topped by giant milk saucers turned the city into an otherworldly sculpture garden. The United Nations Educational, Scientific and Cultural Organization named it a world heritage site in 1987.

Mr. Niemeyer designed the U.N.'s New York headquarters in the late 1940s, with French modernist Le Corbusier—Charles-Édouard Jeanneret—, who influenced Mr. Niemeyer after visiting Brazil in the 1930s.

Mr. Niemeyer often said his greatest inspiration was the undulating landscape of his birthplace, Rio de Janeiro. He used reinforced concrete to trace lines he saw in Rio's sloping hills and its scalloped beaches.

"I am attracted to free-flowing sensual curves," he wrote in his memoir, "The Curves of Time.""The curves that I find in the mountains of my country, the sinuousness of its rivers, in the waves of the ocean and on the body of the beloved woman."

Rio influenced more than his art. A bon vivant who often proclaimed his zest for the company of women, Mr. Niemeyer was said to have embodied the city's bohemian spirit. An active, lifelong communist, he rued the fall of the Soviet Union and befriended Cuban leader Fidel Castro. Mr. Niemeyer's political leanings meant he was denied visas to take prestigious U.S. teaching jobs during his career.

Mr. Niemeyer said the buildings he designed for Brasília were meant to evoke a more egalitarian future. He gave them the illusion of floating by employing reflecting pools and narrow columns set back from building facades.

In practice, Brasília isn't an egalitarian city. Government buildings are set apart at an inhuman scale. It is virtually impossible for a worker to walk between destinations in the blazing, treeless landscape. The city's architecture is better enjoyed from an air-conditioned limousine.

Mr. Niemeyer worked from a studio overlooking Copacabana beach in Rio. In his 90s, he designed projects for Brazilian beach city Niterói. In 2012 he was present for the inauguration of additions to Rio de Janeiro's "Sambadrome" Carnaval stadium.

Mr. Niemeyer's apartment, its walls covered in political posters and sketches of women, was an important destination for the international architects he was famous for warmly welcoming in to exchange ideas.

Alfredo Brillembourg, an architect and Columbia University professor, visited Mr. Niemeyer there in 2009. Mr. Niemeyer was more enthusiastic about recent projects than those of his formative years, Mr. Brillembourg said.

"Normally all architectural critique is viewed from the West. However, Niemeyer's work obliges us to reverse this flow and understand Brazil as a new global cultural center," Mr. Brillembourg said.

Mr. Niemeyer was born to an upper-class Rio family in 1907, one of six children. By his own account, he enjoyed a carefree youth that revolved around soccer and late nights at Rio's beer parlors that often ended in its red-light district.

He enrolled in the city's fine arts academy at the age of 21, and studied under Lúcio Costa, beginning a yearslong collaboration with the prominent Brazilian architect and urban planner. Mr. Niemeyer later took an unpaid job in Mr. Costa's studio.

In 1936, Le Corbusier arrived in Rio to give a series of lectures. Messrs. Niemeyer and Costa worked with him to design a new Ministry of Health and Education, now a Rio landmark. That project was a turning point for Mr. Niemeyer. He started to grab international attention after designing the Brazil pavilion for the 1939 New York World's Fair.

During these years, Mr. Niemeyer made an important connection— Juscelino Kubitschek, an up-and-coming politician who later became one of Brazil's most important democratically elected presidents. As a local leader in the state of Minas Gerais, Mr. Kubitschek tapped Mr. Niemeyer to build a lakefront casino, a church and other buildings in the city of Belo Horizonte.

After Mr. Kubitschek became president in 1955, he asked Mr. Niemeyer to design the buildings for Brasília, the new national capital he envisioned in Brazil's sparsely populated interior. The city was built from scratch, at blinding speed, in an airplane-like layout prepared by Mr. Costa.

In 1947 Mr. Niemeyer and Le Corbusier jointly designed the U.N. building in New York. Later in life, Mr. Niemeyer said he had succumbed to pressure from Le Corbusier to include the larger-than-life French master's ideas in a project that was originally solely his.

He was married for three-quarters of a century to his wife, Annita, and they had one daughter; both predeceased Mr. Niemeyer. In 2006, he was married again, this time to a longtime personal assistant.

—Matthew Cowley contributed to this article.

Write to John Lyons at